keep icon indicating copy to clipboard operation
keep copied to clipboard

can't execute saved command

Open antonio-antuan opened this issue 7 years ago • 3 comments

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

antonio-antuan avatar Apr 23 '17 13:04 antonio-antuan

While saving the new command you probably need to skip the $ character as keep uses it for templates. #24

OrkoHunter avatar Apr 23 '17 13:04 OrkoHunter

Oh, I see... Thanks :)

antonio-antuan avatar Apr 23 '17 13:04 antonio-antuan

same here, this command also produces error: kubectl -n kubernetes-dashboard get secret $(kubectl -n kubernetes-dashboard get sa/admin -o jsonpath="{.secrets[0].name}") -o go-template="{{.data.token | base64decode}}

but adding another $ to escape fixes it when executing keep run

Select a command [1-15] (0 to cancel): 13 Traceback (most recent call last): File "/home/rome/.local/bin/keep", line 8, in sys.exit(cli()) File "/home/rome/.local/lib/python3.9/site-packages/click/core.py", line 1128, in call return self.main(*args, **kwargs) File "/home/rome/.local/lib/python3.9/site-packages/click/core.py", line 1053, in main rv = self.invoke(ctx) File "/home/rome/.local/lib/python3.9/site-packages/click/core.py", line 1659, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/home/rome/.local/lib/python3.9/site-packages/click/core.py", line 1395, in invoke return ctx.invoke(self.callback, **ctx.params) File "/home/rome/.local/lib/python3.9/site-packages/click/core.py", line 754, in invoke return __callback(*args, **kwargs) File "/home/rome/.local/lib/python3.9/site-packages/click/decorators.py", line 84, in new_func return ctx.invoke(f, obj, *args, **kwargs) File "/home/rome/.local/lib/python3.9/site-packages/click/core.py", line 754, in invoke return __callback(*args, **kwargs) File "/home/rome/.local/lib/python3.9/site-packages/keep/commands/cmd_run.py", line 41, in cli final_cmd = utils.substitute_pcmd(pcmd, kargs, safe) File "/home/rome/.local/lib/python3.9/site-packages/keep/utils.py", line 327, in substitute_pcmd return pcmd.substitute(**kargs) File "/usr/lib/python3.9/string.py", line 121, in substitute return self.pattern.sub(convert, self.template) File "/usr/lib/python3.9/string.py", line 118, in convert self._invalid(mo) File "/usr/lib/python3.9/string.py", line 101, in _invalid raise ValueError('Invalid placeholder in string: line %d, col %d' % ValueError: Invalid placeholder in string: line 1, col 44

rome-legacy avatar Nov 06 '21 00:11 rome-legacy