Giter Club home page Giter Club logo

keep's Introduction

logo

logo

PyPI PyPI - Downloads

A Meta CLI toolkit

Your personal shell command keeper

Why?

Writwick Wraj loves using the command line.

Writwick googles "How to do X in terminal?" and multiple forums and blog posts finally provide him the magical command for the rescue. Problem Solved !

Fast forward couple weeks, Writwick has to do X in terminal, again. Wraj remembers solving this few weeks ago. Let him do a reverse-i-search with Ctrl+R. Nope, can't remember sh*t. Browser search history? 25 web pages found matching X. Argh!

Writwik finally finds the solution. From this time Writwik starts writing the commands somewhere online for the future.

Wait, why shouldn't he keep the command in his terminal itself if this is only place where he'll ever have use it?

Features

  • Save a new command with a brief description
  • Search the saved commands using powerful patterns
  • Save the commands as a secret GitHub gist
  • Use keep push and keep pull to sync the commands between GitHub gist and other computers.

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

Installation

$ pip3 install keep

Use Python 3.6 or later.

You can install pip3 using apt-get as sudo apt install python3-pip.

Usage

Usage: keep [OPTIONS] COMMAND [ARGS]...

  Keep and view shell commands in terminal only.

  Read more at https://github.com/orkohunter/keep

Options:
  -v, --verbose  Enables verbose mode.
  --help         Show this message and exit.

Commands:
  edit          Edit a saved command.
  github_token  Register a GitHub Token to use GitHub Gists as a backup.
  grep          Searches for a saved command.
  init          Initializes the CLI.
  list          Shows the saved commands.
  new           Saves a new command.
  pull          Pull commands from saved GitHub gist.
  push          Push commands to a secret GitHub gist.
  rm            Deletes a saved command.
  run           Executes a saved command.
  update        Check for an update of Keep.

See the detailed usage and tutorial.

Command-line Completion

To enable command-line completion (TAB completion) follow these steps for the shell of your choice

bash

  1. Create a directory in your home directory called .bash

     mkdir -p $HOME/.bash
    
  2. Copy completion/keep.bash to $HOME/.bash/keep

     curl -SLo "$HOME/.bash/keep" "https://raw.githubusercontent.com/OrkoHunter/keep/master/completions/keep.bash"
    
  3. Add the following lines to $HOME/.bashrc file

     [ -f "$HOME/.bash/keep" ] && . "$HOME/.bash/keep"
    

zsh

  1. Create a directory in your home called .zsh

     mkdir -p $HOME/.zsh
    
  2. Copy completion/keep.zsh to $HOME/.zsh/_keep

     curl -SLo "$HOME/.zsh/_keep" "https://raw.githubusercontent.com/OrkoHunter/keep/master/completions/keep.zsh"
    
  3. Add the following lines inside $HOME/.zshrc file

     fpath=($HOME/.zsh $fpath)
     autoload -Uz compinit && compinit
    

Contribute

This is a very young project. If you have got any suggestions for new features or improvements, please comment over here. Pull Requests are most welcome !


Not a command line fanatic? Here are some resources for you :

keep's People

Contributors

0xrushi avatar ahadafzal avatar alexandr-san4ez avatar athityakumar avatar crpb avatar crushingcodes avatar dibyadas avatar fireping32 avatar muhammedikinci avatar nfsergiu avatar orkohunter avatar podiospaz avatar r0fls avatar rahuliyer95 avatar rluvaton avatar yegarti avatar zorroblue avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

keep's Issues

Errors after updating keep from v2.4.2 to v2.6.1

File "/home/kris/.local/lib/python2.7/site-packages/keep/utils.py", line 72, in list_commands
    table_data.append(['$ ' + cmd, fields['desc'], fields['alias']])
TypeError: string indices must be integers

I was getting the above error when trying to run any keep command. Rolled back to v.2.4.2.

Can't Re-Register/Sign-In

I had to reinstall Yosemite on my MacAir due tosome issues. Before doing the reinstall, I pushed all my keep commands to your Heroku server. Now there is no way to Sign-In and pull my commands.

Luckily I have a backup of my ~/.keep folder from where I can get my commands.

Harshad@Harshads-MacBook-Air:~    - - - - - - - - - - - - - - - - - - - - - - -
 ❯  keep init
Initializing environment in ~/.keep directory
...OK
Proceed to register? [Y/n]: Y
Your credentials will be saved in the ~/.keep directory.
Email: [email protected]
Repeat for confirmation: [email protected]
Verifying with existing users...
User already exists !
Email: [email protected]
Repeat for confirmation: [email protected]
Generated password for [email protected]
Registering new user ...

Harshad@Harshads-MacBook-Air:~    - - - - - - - - - - - - - - - - - - - - - - -
 ❯  keep pull
You are not registered.
Proceed to register? [Y/n]: Y
Your credentials will be saved in the ~/.keep directory.
Email: [email protected]
Repeat for confirmation: [email protected]
Verifying with existing users...
User already exists !
Email: [email protected]
Repeat for confirmation: [email protected]
Generated password for [email protected]
Registering new user ...

Currently the ~/.keep folder is empty.

Hangs indefinitely.

keep watch -n 1 free -h hangs indefinitely. Installed using pip install keep. Any solutions?

Can't pull if there is no commands

Can't pull when there are no commands

Error trace:

home-server@home-server:~$ keep pull
[CRITICAL] Replace local commands with GitHub gist
Gist URL : https://gist.github.com/<my-gist-id>? [y/N]: y
Traceback (most recent call last):
  File "/usr/local/bin/keep", line 10, in <module>
    sys.exit(cli())
  File "/usr/lib/python3/dist-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/keep/commands/cmd_pull.py", line 23, in cli
    os.remove(commands_file_path)
FileNotFoundError: [Errno 2] No such file or directory: '/home/home-server/.keep/commands.json'

TypeError: string indices must be integers in utils.py

Traceback (most recent call last):
File "/home/justin/.local/bin/keep", line 11, in
sys.exit(cli())
File "/usr/lib/python3/dist-packages/click/core.py", line 722, in call
return self.main(*args, **kwargs)
File "/usr/lib/python3/dist-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/lib/python3/dist-packages/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/lib/python3/dist-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/lib/python3/dist-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/lib/python3/dist-packages/click/decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args[1:], **kwargs)
File "/usr/lib/python3/dist-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/home/justin/.local/lib/python3.6/site-packages/keep/commands/cmd_list.py", line 14, in cli
utils.list_commands(ctx)
File "/home/justin/.local/lib/python3.6/site-packages/keep/utils.py", line 72, in list_commands
table_data.append(['$ ' + cmd, fields['desc'], fields['alias']])
TypeError: string indices must be integers

Entirely suspect user error of some form but I'm not much of a python developer and don't see anything overly wrong there.
Running keep works fine.
Above trace was from keep list
Reverting back to 2.4.2 works fine other than a nag to update.

make a new release

some of the issues are fixed, but i am still getting error when I install keep using pip.
for eg.
Screenshot from 2020-02-19 21-22-48
This error is already fixed and merged in master.

Running commands by using arguments

I have been using this tool for a while. It's amazing and very useful. It would be better if we could run commands with arguments (e.g passing variable data), so we don't have to write the whole command everytime.

Git push not working

When I use the Keep Push command I get the following output;
Traceback (most recent call last):
File "/usr/bin/keep", line 10, in
sys.exit(cli())
File "/usr/lib64/python3.4/site-packages/click/core.py", line 764, in call
return self.main(*args, **kwargs)
File "/usr/lib64/python3.4/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/usr/lib64/python3.4/site-packages/click/core.py", line 1132, in invoke
cmd_name, cmd, args = self.resolve_command(ctx, args)
File "/usr/lib64/python3.4/site-packages/click/core.py", line 1171, in resolve_command
cmd = self.get_command(ctx, cmd_name)
File "/usr/lib/python3.4/site-packages/keep/cli.py", line 59, in get_command
None, None, ['cli'])
File "/usr/lib/python3.4/site-packages/keep/commands/cmd_push.py", line 17
gist_url = f"https://gist.github.com/{token['gist']}"

Commands.json is created on Github but doesn't contain anything.

UnicodeEncodeError

Getting UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-2: ordinal not in range(128)
after trying to search command with grep:
╰─± python slack_bot.py 2>&1 | tee /tmp/slack.log

Command templates?

How about command templates?
say I have to run following command again n again.
python logplot.py run_NPT_long_prod_jan_30.txt Step TotEng

Is there a way I can replace the .txt file each time? A command template or something similar is what I can think of now.

Keep edit won't save an empty file

When I keep edit and try to delete all my commands then try to save the file, it doesn't save my changes. Therefore when I type keep list again it shows my list with my old commands and without my changes. Not sure if this is a huge problem because you could just keep rm all your commands or just keep init to get an empty list again but thought I'd mention it.

Using `~/.zsh_history` to keep commands

How can I use commands from ~/.zsh_history in keep?

something like, keep ssh from history -- gives me option to choose from all the commands that have ssh in them (via grep?)

Improve Speed

Profile the whole codebase and identify the bottlenecks.

Write Migration script for Alias command in keep

Hi there, great work on this package!

One feature I feel like a big miss is to allow the possibility of an alias association to the new command. Don't you think this would be useful?

Thank you,
Paolo

Add -n capability to command execution bypass confirmation when selecting from the list.

I am trying out keep. I want the ability to type "keep run" and select a number from the list:

keep run 3

I do not want to have to press Y/n every time, this is quite annoying.

I see you can type a command "keep run command -n" and not get the conformation. How can I remove the confirmation when selecting a command from the run list?

For keep to be useful it needs to save time over doing a reverse search but these speed bumps add a lot of friction.

Gitter webhook by Travis

Configure travis.yml for the integration with the gitter channel

Instruction -

Add the following to your .travis.yml configuration:

notifications:
  webhooks:
    urls:
      - YOUR_WEBHOOK_URL
    on_success: change  # options: [always|never|change] default: always
    on_failure: always  # options: [always|never|change] default: always
    on_start: never     # options: [always|never|change] default: always
Your unique webhook url for this service:

https://webhooks.gitter.im/e/e2cb07f7d46abee5db81

keep rm - How does it work?

Hi,
Thanks for this great util!

How can I remove a command? I tried removing by description and the command but it did not work.

On a dumb terminal the table output of `keep list` now is unreadable and contains the wrong escape sequences.

When using keep on "dump" terminals (TERM=dumb) the command keep list produces a table with the wrong escape sequences:

^[(0lqqqqqqqqqqqqwqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqwqqqqqqqk^[(B
^[(0x^[(B Command    �(0x�(B Description                                       �(0x�(B Alias �(0x�(B
^[(0tqqqqqqqqqqqqnqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqnqqqqqqqu^[(B
^[(0x^[(B $ git      �(0x�(B Get changes from the base of my GitHub fork / How �(0x�(B       �(0x^[(B
^[(0x^[(B fetch      �(0x�(B to sync a fork - Part 1 of 2                      �(0x�(B       �(0x^[(B
^[(0x^[(B upstream   �(0x�(B                                                   �(0x�(B       �(0x^[(B
^[(0tqqqqqqqqqqqqnqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqnqqqqqqqu^[(B

Is it possible to fall back to plain ASCII output (as, I think, it was in older versions)? Or force plain ASCII output with a command line option?

Distributed

Store the database at a central place and make it available to the user at each one of their computers.

Version database schema

A schema number helps in migrating the old database to a new schema when new features are added in the library.
As of now there is no schema number assigned, and with addition of alias, the commands will break.

keep is slow (or maybe click is)

keep --help takes about 0.42 seconds. The python functions inside utils all take time in milliseconds.

I have absolutely no clue. Maybe click is adding a lot of overhead.

[Feature] autocomplete run

Nice and simple tool! Just installed it today.
My first idea to improve it slightly: suggestions after the run command when pressing tab.
I don't know about the bash stuff, but if it's easy to implement, it would be worth. At least I would probably use it a lot ;)

Remove sync with personal herokuapp

Pros:

  • No more security issues
  • Network requests slow down keep
  • It's not a critical feature
    Cons:
  • Need to find additional ways to sync the dotfiles

I'll go ahead and remove the heroku app out of the software.

Need to reset credentials

I didn't do keep init first, so the folder wasn't there, and keep credential file failed to create.
Register fails because the user exists on your heroku api server.
How can I reset the credentials?

keep push not working

I ran keep github_token successfully. Got this
token9 21-50-27

Then I ran keep push , I got the below error.
Screenshot from 2020-02-19 21-51-05

Notes from Metakgp demo day

Demo: https://www.youtube.com/watch?v=eXJPEQlpnZQ

@icyflame's suggestion:

A couple of things about Himanshu's demo:

1. You can use arguments in the middle using Bash functions. It's very useful for things like ImageMagick, youtube-dl, ffmpeg, etc.
2. I kept comparing keep to `history | ag "search"` and the zsh autocomplete plugin. So, if keep were just as fast as those two, it would be worth a try!

I can certainly see `keep`'s usefulness for people starting out with the command line. :+1:

`keep list` output

Output of keep list is unreadable when storing really long commands in keep (see screenshot, please). It’s good idea to use for it list with highlighting (like git log) but not table, I think.

keep list

Module not found

I installed Keep on a new server.
When I use Python 3.6 I get an error;
Traceback (most recent call last):
File "/usr/bin/keep", line 6, in
from keep.cli import cli
ModuleNotFoundError: No module named 'keep'
[root@srv4 ~]# keep pull
Traceback (most recent call last):
File "/usr/bin/keep", line 6, in
from keep.cli import cli
ModuleNotFoundError: No module named 'keep'

JSON Decode error on doing keep init

This is the full traceback of the error I am getting:

anomaly_@fibonacci ~/Downloads/keep (master) $ keep init
[CRITICAL] Remove everything inside ~/.keep ? [y/N]: y
Initializing environment in ~/.keep directory
...OK
Proceed to register? [Y/n]: y
Your credentials will be saved in the ~/.keep directory.
Email: [email protected]
Repeat for confirmation: [email protected]
Verifying with existing users...
Traceback (most recent call last):
  File "/home/anomaly_/miniconda3/bin/keep", line 11, in <module>
    load_entry_point('keep==2.4.2', 'console_scripts', 'keep')()
  File "/home/anomaly_/miniconda3/lib/python3.6/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/anomaly_/miniconda3/lib/python3.6/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/anomaly_/miniconda3/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/anomaly_/miniconda3/lib/python3.6/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/anomaly_/miniconda3/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/anomaly_/miniconda3/lib/python3.6/site-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args[1:], **kwargs)
  File "/home/anomaly_/miniconda3/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/anomaly_/miniconda3/lib/python3.6/site-packages/keep-2.4.2-py3.6.egg/keep/commands/cmd_init.py", line 14, in cli
    utils.first_time_use(ctx)
  File "/home/anomaly_/miniconda3/lib/python3.6/site-packages/keep-2.4.2-py3.6.egg/keep/utils.py", line 54, in first_time_use
    register()
  File "/home/anomaly_/miniconda3/lib/python3.6/site-packages/keep-2.4.2-py3.6.egg/keep/utils.py", line 125, in register
    if r.json()['exists']:
  File "/home/anomaly_/miniconda3/lib/python3.6/site-packages/requests/models.py", line 892, in json
    return complexjson.loads(self.text, **kwargs)
  File "/home/anomaly_/miniconda3/lib/python3.6/json/__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "/home/anomaly_/miniconda3/lib/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/home/anomaly_/miniconda3/lib/python3.6/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

I have tried building the package from source too, but the same error comes.

Delete command

It'd be a good feature to allow user to delete a saved command using keep command.

Windows strftime incompatibility

Not sure if this is the only roadblock to windows compatibility, but I think the %D strftime format code isn't compatible with windows?

I attempted to run this on python 3.4 and I'm getting:

Traceback (most recent call last):                                                     
  File "c:\python34\lib\runpy.py", line 170, in _run_module_as_main                    
    "__main__", mod_spec)                                                              
  File "c:\python34\lib\runpy.py", line 85, in _run_code                               
    exec(code, run_globals)                                                            
  File "C:\Python34\Scripts\keep.exe\__main__.py", line 9, in <module>                 
  File "c:\python34\lib\site-packages\click\core.py", line 722, in __call__            
    return self.main(*args, **kwargs)                                                  
  File "c:\python34\lib\site-packages\click\core.py", line 696, in main                
    with self.make_context(prog_name, args, **extra) as ctx:                           
  File "c:\python34\lib\site-packages\click\core.py", line 621, in make_context        
    self.parse_args(ctx, args)                                                         
  File "c:\python34\lib\site-packages\click\core.py", line 1018, in parse_args         
    rest = Command.parse_args(self, ctx, args)                                         
  File "c:\python34\lib\site-packages\click\core.py", line 880, in parse_args          
    value, args = param.handle_parse_result(ctx, opts, args)                           
  File "c:\python34\lib\site-packages\click\core.py", line 1404, in handle_parse_result
    self.callback, ctx, self, value)                                                   
  File "c:\python34\lib\site-packages\click\core.py", line 78, in invoke_param_callback
    return callback(ctx, param, value)                                                 
  File "c:\python34\lib\site-packages\click\core.py", line 809, in show_help           
    echo(ctx.get_help(), color=ctx.color)                                              
  File "c:\python34\lib\site-packages\click\core.py", line 496, in get_help            
    return self.command.get_help(self)                                                 
  File "c:\python34\lib\site-packages\click\core.py", line 830, in get_help            
    self.format_help(ctx, formatter)                                                   
  File "c:\python34\lib\site-packages\click\core.py", line 845, in format_help         
    self.format_options(ctx, formatter)                                                
  File "c:\python34\lib\site-packages\click\core.py", line 956, in format_options      
    self.format_commands(ctx, formatter)                                               
  File "c:\python34\lib\site-packages\click\core.py", line 1000, in format_commands    
    for subcommand in self.list_commands(ctx):                                         
  File "c:\python34\lib\site-packages\keep\cli.py", line 40, in list_commands          
    utils.check_update()                                                               
  File "c:\python34\lib\site-packages\keep\utils.py", line 23, in check_update         
    today = datetime.date.today().strftime("%D")                                       
ValueError: Invalid format string                                                      ```

Categorize commands by project

Hi,

This is a great tool. I work on multiple projects at a time and was wondering if there is a way to categorize or group commands in some way? By a project label for eg?

Thanks,
Minita

can't execute saved command

I can't execute saved command, which installs oh-my-zsh. All Other commands executes without errors.

~ keep list     
Command                                                                                                   Description
--------------------------------------------------------------------------------------------------------  -----------------
$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"  install oh-my-zsh
➜  ~ keep run zsh



 1      $ sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" :: install oh-my-zsh





Traceback (most recent call last):
  File "/usr/bin/keep", line 11, in <module>
    load_entry_point('keep', 'console_scripts', 'keep')()
  File "/usr/lib/python3.6/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3.6/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args[1:], **kwargs)
  File "/usr/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/keep/commands/cmd_run.py", line 48, in cli
    final_cmd = utils.substitute_pcmd(pcmd, kargs, safe)
  File "/usr/lib/python3.6/site-packages/keep/utils.py", line 234, in substitute_pcmd
    return pcmd.substitute(**kargs)
  File "/usr/lib/python3.6/string.py", line 126, in substitute
    return self.pattern.sub(convert, self.template)
  File "/usr/lib/python3.6/string.py", line 123, in convert
    self._invalid(mo)
  File "/usr/lib/python3.6/string.py", line 99, in _invalid
    (lineno, colno))
ValueError: Invalid placeholder in string: line 1, col 8

New features and improvements

  • keep pull replaces the existing commands with new one. The default option should be to update not replace while replace being available as an option to the user
  • Use shell history to save commands #3
  • keep rm
  • Give option of giving password input while registering an existing user
  • Outdated warning while using
  • keep run should be more interactive
  • Don't execute pull if never pushed on server.

Can't register

Your credentials will be saved in the ~/.keep directory.
Email: [email protected]
Repeat for confirmation: [email protected]
Verifying with existing users...
Traceback (most recent call last):
  File "/usr/local/bin/keep", line 11, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args[1:], **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/keep/commands/cmd_register.py", line 13, in cli
    utils.register()
  File "/usr/local/lib/python2.7/dist-packages/keep/utils.py", line 109, in register
    if r.json()['exists']:
  File "/usr/local/lib/python2.7/dist-packages/requests/models.py", line 866, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/simplejson/__init__.py", line 516, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python2.7/dist-packages/simplejson/decoder.py", line 374, in decode
    obj, end = self.raw_decode(s)
  File "/usr/local/lib/python2.7/dist-packages/simplejson/decoder.py", line 404, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
simplejson.scanner.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

export command not working

The keep command does not appear to be changing CDPATH even though the exact same command run without keep seems to work:

(base) user:~$ echo $CDPATH
/home/mike
(base) user:~$ keep run set

 1	$ export CDPATH=.:~/Documents/programming_projects/ :: Set CDPATH to ~ and programming_projects

Execute
	$ export CDPATH=.:~/Documents/programming_projects/ :: Set CDPATH to ~ and programming_projects

? [Y/n]: y
(base) user:~$ echo $CDPATH
/home/mike
(base) user:~$ export CDPATH=.:~/Documents/programming_projects/
(base) user:~$ echo $CDPATH
.:/home/mike/Documents/programming_projects/

Any idea whats going on here?

Why not just a dotfiles repo and grep/ag?

I have solved this problem by keeping a unified dotfiles repo that pulls in additional *.zsh files depending on the hostname. Installation is basic:

{package manager of choice} install zsh git
git clone {my dotfiles repo} ~/.dotfiles/
cd ~/.dotfiles && ./install

Dotbot takes care of installing additional stuff and linking the .zsh files (among other shared conf). Setting it up on a new machine is a breeze and updating the repo boils down to a git pull and . ~/.zshrc (which can be aliased).

If you want to have a way to lookup stuff then just set an alias for grepping/ag the ~/.dotfiles/ folder and keep comments on each alias. Running stuff is just typing in the alias (which is auto-completed y zsh either ways).

This has an additional bonus of a shared repository of aliases (which by design are mnemonic and easy to remember). Also Cross-distribution stuff can be abstracted away too with basic conditional logic so that i {package name} will install stuff no matter what distro I'm currently on, etc.

Also the hostname-based includes allow me to exclude stuff that are not required (eg. ADB stuff on my Raspberry Pi which I use only through SSH or setting a lightweight prompt for it).

On top of that there are no external dependencies (not counting ZSH, git and python 2.6=>).

What advantage this project has over that setup?

Document variable argument commands feature of keep

When saving new commands with keep, if some "word" is prefixed with $, it becomes a variable. And when it is run by keep, the tool asks for an input.

Document this behaviour well in the README and maybe in keep CLI. A lot of users are not aware about it.

See #70 #26 #24

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.