Skip to content

Commit cb85dc6

Browse files
committed
Update docs about push and pull
1 parent 48aad87 commit cb85dc6

File tree

3 files changed

+27
-28
lines changed

3 files changed

+27
-28
lines changed

README.rst

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@ Features
3030

3131
- Save a new command with a brief description
3232
- Search the saved commands using powerful patterns
33-
- ~Save the commands on the remote on the server~
34-
- ~Use ``keep push`` and ``keep pull`` to sync the commands between all your computers.~
35-
33+
- Save the commands as a secret GitHub gist
34+
- Use ``keep push`` and ``keep pull`` to sync the commands between GitHub gist and other computers.
3635

3736
**ProTip : Save the commands you usually forget in ssh sessions and sync it with your local machine.**
3837

@@ -64,14 +63,17 @@ Usage
6463
--help Show this message and exit.
6564

6665
Commands:
67-
grep Searches for a saved command.
68-
init Initializes the CLI.
69-
list Show the saved commands.
70-
new Saves a new command.
71-
rm Deletes a saved command.
72-
run Executes a saved command.
73-
update Check for an update of Keep.
74-
66+
edit Edit a saved command.
67+
github_token Register a GitHub Token to use GitHub Gists as a backup.
68+
grep Searches for a saved command.
69+
init Initializes the CLI.
70+
list Shows the saved commands.
71+
new Saves a new command.
72+
pull Pull commands from saved GitHub gist.
73+
push Push commands to a secret GitHub gist.
74+
rm Deletes a saved command.
75+
run Executes a saved command.
76+
update Check for an update of Keep.
7577

7678
`See the detailed usage and tutorial. <https://github.com/OrkoHunter/keep/blob/master/tutorial.md>`_
7779

keep/commands/cmd_github_token.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ def cli(ctx):
2020
abort=True):
2121
os.remove(dir_path)
2222

23-
token = click.prompt('Create a GitHub token with permission to Gists and paste here : ')
23+
token = click.prompt('Create a GitHub token with permission to Gists and paste here ')
2424
gist_id = existing_token.get('gist') if existing_token else None
25-
prompt_str = 'If you already have a GitHub gist created by keep, paste the Gist ID here, or else press Enter : '
25+
prompt_str = 'If you already have a GitHub gist created by keep, paste the Gist ID here, or else press Enter '
2626
new_gist_id = click.prompt(prompt_str, default='', show_default=False)
2727

2828
if new_gist_id:
@@ -37,3 +37,6 @@ def cli(ctx):
3737

3838
with open(dir_path, 'w') as f:
3939
json.dump({'token': token, 'gist': gist_id}, f)
40+
41+
click.echo("Done! Gist URL - https://gist.github.com/" + gist_id)
42+
click.echo("You can now use `keep push` or `keep pull`")

tutorial.md

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
1-
Note: Push, Pull and Register are disabled. Sync will be re-enabled using github gist.
2-
31
# Tutorial
42

53
- Initialize Keep with `keep init`. This creates a `.keep` directory in your home folder.
6-
- You are then asked to register.
7-
- It asks for your Email because that is unique to you. It is just another username and thus you can input anything
8-
unique to you.
9-
- You can choose to not register this time and later start the process by using `keep register`.
10-
- You can use Keep CLI without registering if you do not intend to use the server for storing or fetching your commands.
11-
- It generates a 255 bit password for you. It is then stored inside your `~/.keep/.credentials` file.
124
- Start saving commands using `keep new`.
135
- Once you have saved couple of commands, start using `keep grep`.
146
- This is not exactly similar to `keep list | grep` as `keep grep` search is more powerful.
15-
- Now it's time to store the commands on the server. Use `keep push`.
16-
- If you have got another computer, install `keep` on it. Do `keep init` and skip registration. Copy your `~/.keep/.credentials` over to that computer in the same location.
7+
- Use `keep github_token` to register a GitHub token for gist as backup. It is then stored inside your `~/.keep/.credentials` file.
8+
- Now it's time to store the commands on github gists. Use `keep push`.
9+
- **NOTE: keep creates a secret GitHub gist. They can still be accessed using the direct URL of the gist.**
10+
- If you have got another computer, install `keep` on it. Do `keep init`. Copy your `~/.keep/.credentials` over to that computer in the same location, or follow `keep github_token`.
1711
- Do `keep pull` to retrieve all the saved commands.
1812
- Have fun !
1913

@@ -27,7 +21,7 @@ Note: Push, Pull and Register are disabled. Sync will be re-enabled using github
2721
<dd>This is used to search for saved commands.<br><br>Argument passed to <code>keep grep</code> is interpreted in two ways. First, it is interpreted as a regular expression and if it matches any command or description, then the search is displayed. If this fails, the argument is then splitted and the individule words of the argument are searched in the commands and the descriptions. If all the splits of the argument are found in a command or a discription, the result is displayed.</dd>
2822

2923
<dt><a href="https://github.com/OrkoHunter/keep/blob/master/keep/commands/cmd_init.py">init</a></dt>
30-
<dd>Initializes the CLI.<br><br>The CLI is supposed to be installed if there exists a <code>.keep</code> direcotry in the home directory. Once installed, this command is not supposed if the user intends to reset the local database of keep.</dd>
24+
<dd>Initializes the CLI.<br><br>The CLI is supposed to be installed if there exists a <code>.keep</code> direcotry in the home directory. Once installed, this command is not supposed to be used unless the user intends to reset the local database of keep.</dd>
3125

3226
<dt><a href="https://github.com/OrkoHunter/keep/blob/master/keep/commands/cmd_list.py">list</a></dt>
3327
<dd>Shows the saved commands.<br><br>Keep uses tabulate library to show the result. If the command length is long, the table may look like in need of wrapping. But increasing the terminal width works for the best.</dd>
@@ -36,13 +30,13 @@ Note: Push, Pull and Register are disabled. Sync will be re-enabled using github
3630
<dd>Saves new command locally.<br><br>If the command already exists, it updates the previously stored description.</dd>
3731

3832
<dt><a href="https://github.com/OrkoHunter/keep/blob/master/keep/commands/cmd_pull.py">pull</a></dt>
39-
<dd>Updates the local commands with remote.<br><br>Once registered, this command fetches your database saved on the remote and updates the local storage.</dd>
33+
<dd>Updates the local commands with saved GitHub gist.<br><br>Once registered, this command fetches your database saved on the remote (GitHub gist) and updates the local storage.</dd>
4034

4135
<dt><a href="https://github.com/OrkoHunter/keep/blob/master/keep/commands/cmd_push.py">push</a></dt>
42-
<dd>Updates remote with local commands.<br><br>This command updates the remote database with the local storage. Consider using this command before storing a new command on some other computer without pulling the latest changes.</dd>
36+
<dd>Updates GitHub gist with local commands.<br><br>This command updates the remote (GitHub gist) with the local storage. Consider using this command before storing a new command on some other computer without pulling the latest changes.</dd>
4337

44-
<dt><a href="https://github.com/OrkoHunter/keep/blob/master/keep/commands/cmd_register.py">register</a></dt>
45-
<dd>Create remote for the user.<br><br>If not registered while <code>keep init</code>, this command can be used for the same purpose in future.</dd>
38+
<dt><a href="https://github.com/OrkoHunter/keep/blob/master/keep/commands/cmd_github_token.py">github_token</a></dt>
39+
<dd>Register a GitHub token.<br><br>Register a GitHub token to use push and pull commands with a GitHub gist.</dd>
4640

4741
<dt><a href="https://github.com/OrkoHunter/keep/blob/master/keep/commands/cmd_rm.py">rm</a></dt>
4842
<dd>Deletes a command.<br><br>Input the exact command you have saved and this removes it from the local storage. If the user uses <code>push</code> after removing any command, the same will be overwritten on the remote.</dd>

0 commit comments

Comments
 (0)