A command-line tool that automatically uploads images from the markdown document to the GitHub repo and replaces the paths with the returned URL.
- TO DO
- Supported platforms
- Usage and Demo
- Getting Started
- What pup can NOT do
- Uninstallation
- How it works
- Use system password management to store TOKEN
- Multithreading file manipulation
- Relative image path support
- Async I/O
Theoretically, all UNIX platforms should be supported. But only tested on Linux with Gnome Desktop.
$ pup --help
A command-line tool that automatically uploads images from the markdown document to the GitHub repo and replaces the paths with the returned URL
Usage: pup [OPTIONS] [FILEPATH]
Arguments:
[FILEPATH] The target markdown or image file
Options:
--set-token Set the token
--update-token Update the token
--delete-token Delete the token
-h, --help Print help
-V, --version Print version
-
Go to token-settings to generate a new token, make sure it has access to your picture repo.
-
get the
pup
binary$ cargo install --git https://github.com/SteveLauC/pup
-
Double check you have pup installed
$ which pup /home/$USER/.cargo/bin/pup
-
init config file
$ pup name is unset. repo is unset. mail is unset.
-
On your first run,
pup
will create a configuration file and complain about the incompleteness of it to you. If you have$XDG_CONFIG_HOME
validly set, then it is located in$XDG_CONFIG_HOME/pup
; Otherwise, it is under$HOME/.config/pup
-
Then edit it to make it complete.
# vim $XDG_CONFIG_HOME/pup/config.toml if you have $XDG_CONFIG_HOME set $ vim $HOME/.config/pup/config.toml
Make it something like the following one, remeber to replace each field with your own one.
github_user_name = "SteveLauC" github_repo_name = "test-repo" mail = "stevelauc@outlook.com"
-
Let's try it again!
$ pup No TOKEN available. Use `pup --set-token` to set it
Ohhhh, since we haven't entered a token yet, pup asks us to do this.
-
Set the token: enter the token and press enter to confirm.
$ pup --set-token Please input the new TOKEN:
-
All configuration is done! Time to enjoy:)
$ pup your-markdown-file.md # or $ pup image.jpeg/jpg/png/gif
- Puting multi images in a single line is not supported.
- The causes of failure may be confusing. For example, you may upload a photo
that has already been uploaded, perhaps you are expecting something like
[FAILED]: DuplicateFile
, but pup will tell you[FAILED]: ValidationFaile
.
If you have set TOKEN in pup, use pup --delete-token
to delete it first.
Then:
$ cargo uninstall pup