A CLI application for interacting with ttm.sh
This repository has been archived on 2019-04-12. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
Jake 6a579633ba
Remove funny messages, add colours
2019-04-12 16:42:21 +01:00
.editorconfig Add 'from NPM' section and module docs 2019-03-22 19:46:33 +00:00
.gitignore Initial commit 2019-03-22 06:47:56 -04:00
LICENSE Initial commit 2019-03-22 06:47:56 -04:00
README.md Add asciinema demo 2019-03-23 22:49:59 +00:00
cli.js Remove funny messages, add colours 2019-04-12 16:42:21 +01:00
config.json Add estimated file life 2019-04-09 19:09:28 +01:00
index.js Remove funny messages, add colours 2019-04-12 16:42:21 +01:00
package.json Remove funny messages, add colours 2019-04-12 16:42:21 +01:00
yarn.lock Remove funny messages, add colours 2019-04-12 16:42:21 +01:00

README.md

ttm.sh CLI

A CLI application for interacting with ttm.sh.

asciicast

Although this is mainly a CLI application, there is also a module that you can use in your own projects!

1. Installation

1.1. From NPM

This method is recommended as there is less setup.

npm install -g ttmsh
# now you can use the command 'ttmsh'

1.2. From Source

git clone https://tildegit.org/jakew/ttmsh-cli.git
cd ttmsh-cli
npm install
npm link
# now you can use the command 'ttmsh' or 'node ./cli.js' or './cli.js' (only on nix)

2. Usage

2.1. Shorten

You can either include the URL in your command:

jakew@tilde:~$ ttmsh shorten https://google.co.uk
√ https://ttm.sh/Ef

...or not include it and be asked later:

jakew@tilde:~$ ttmsh shorten
√ Which URL would you like to shorten? · https://google.co.uk
√ https://ttm.sh/Ef

Note: You will be asked again if you pass in an invalid URL.

2.2. Upload

Like with shorten, you can either include a file path in your command:

jakew@tilde:~$ ttmsh upload message.txt
√ https://ttm.sh/j0.txt

...or don't include it and be asked later:

jakew@tilde:~$ ttmsh upload
√ Which file would you like to upload? · message.txt
√ https://ttm.sh/j0.txt

3. Module

You can also use the mini API wrapper in your application. Here's some example code on how to use it.

const ttmsh = require("ttmsh");

// upload a file to ttm.sh
ttmsh.do("upload", "/path/to/file/to/upload.txt").then((result) => {
  console.log(`Here's your link: ${result}`);
}).catch((err) => {
  console.error("Something went wrong.", err);
});

// shorten a link with ttm.sh
ttmsh.do("shorten", "https://example.com/this/is/a/long/url").then((result) => {
  console.log(`Here's your link: ${result}`);
}).catch((err) => {
  console.error("Something went wrong.", err);
});

4. Contributing

I'd love for people to add in new features and improve on my current work so feel free to open a pull request!