mirror of
https://github.com/denisidoro/navi
synced 2024-11-10 14:04:17 +00:00
Add doc for auto-updating repositories (#417)
This commit is contained in:
parent
5a758f00e1
commit
9ead55e342
2 changed files with 24 additions and 0 deletions
|
@ -64,6 +64,7 @@ You can also:
|
|||
- [import cheatsheets from git repositories](docs/cheatsheet_repositories.md#importing-cheatsheets)
|
||||
- [write your own cheatsheets](#cheatsheet-syntax) (and [share them](docs/cheatsheet_repositories.md#submitting-cheatsheets), if you want)
|
||||
- [use cheatsheets from other tools](docs/cheatsheet_repositories.md#using-cheatsheets-from-other-tools), such as [tldr](https://github.com/tldr-pages/tldr) and [cheat.sh](https://github.com/chubin/cheat.sh)
|
||||
- [auto-update repositories](docs/cheatsheet_repositories.md#auto-updating-repositories)
|
||||
|
||||
Cheatsheet syntax
|
||||
-----------------
|
||||
|
|
|
@ -6,6 +6,7 @@ Cheatsheet repositories
|
|||
* [Adding your own cheatsheets](#adding-your-own-cheatsheets)
|
||||
* [Submitting cheatsheets](#submitting-cheatsheets)
|
||||
* [Using cheatsheets from other tools](#using-cheatsheets-from-other-tools)
|
||||
* [Auto-updating repositories](#auto-updating-repositories)
|
||||
|
||||
### Browsing through cheatsheet repositories
|
||||
|
||||
|
@ -44,3 +45,25 @@ You can use cheatsheets from [cheat.sh](https://github.com/chubin/cheat.sh) by r
|
|||
```sh
|
||||
navi --cheatsh <query>
|
||||
```
|
||||
|
||||
### Auto-updating repositories
|
||||
|
||||
Right now, **navi** doesn't have support for auto-updating out of the box. However, you can achieve this by using `git` and `crontab`.
|
||||
|
||||
First make sure you cloned your repo using `git` to the correct folder:
|
||||
```sh
|
||||
user="<user>"
|
||||
repo="<repo>"
|
||||
git clone "https://github.com/${user}/${repo}" "$(navi info cheats-path)/${user}__${repo}"
|
||||
```
|
||||
|
||||
Then, add a cron job:
|
||||
```sh
|
||||
crontab -e
|
||||
*/0 11 * * * bash -c 'cd "$(/usr/local/bin/navi info cheats-path)/<user>__<repo>" && /usr/local/bin/git pull -q origin master'
|
||||
```
|
||||
|
||||
Please note the cron job above is just an example and you should edit it accordingly:
|
||||
- In this example, the cron job is triggered every day at 11am. [crontab guru](https://crontab.guru/) may come in handy if you want to change this value
|
||||
- The full paths to `navi` and `git` may differ in your setup. Check their actual values using `which navi` and `which git`
|
||||
- Don't forget to replace `<user>__<repo>` with the actual folder name
|
Loading…
Reference in a new issue