cloudnativelabs / kube-shell

Kubernetes shell: An integrated shell for working with the Kubernetes
Apache License 2.0
2.38k stars 175 forks source link

Trying to make a alias in OS X causes exception #47

Open roffe opened 6 years ago

roffe commented 6 years ago

When i try to create a alias in kube-shell i get a exception the instant i press '

so i type alias kc=' and then comes the stacktrace

if i finnish typing my line and press enter the alias gets created

Running in OS X high Sierra.

➜  ~ pip show kube-shell
Name: kube-shell
Version: 0.0.23
Summary: Kubernetes shell: An integrated shell for working with the Kubernetes CLI
Home-page: https://github.com/cloudnativelabs/kube-shell
Author: Cloudnative Labs
Author-email: UNKNOWN
License: Apache License 2.0
Location: /Library/Python/2.7/site-packages
Requires: fuzzyfinder, prompt-toolkit, Pygments, kubernetes, click

kube-shell> alias kc='Exception in thread Thread-21:
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 763, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/Library/Python/2.7/site-packages/prompt_toolkit/interface.py", line 865, in run
    completions = list(buffer.completer.get_completions(document, complete_event))
  File "/Library/Python/2.7/site-packages/kubeshell/completer.py", line 41, in get_completionsit
    tokens = shlex.split(cmdline)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shlex.py", line 279, in split
    return list(lex)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shlex.py", line 269, in next
    token = self.get_token()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shlex.py", line 96, in get_token
    raw = self.read_token()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shlex.py", line 172, in read_token
    raise ValueError, "No closing quotation"
ValueError: No closing quotation
roffe commented 6 years ago

However it doesn't seem like it's actually doing anything

kube-shell> alias kc='kubectl'
kube-shell> kc get po
/bin/sh: kc: command not found
murali-reddy commented 6 years ago

Thanks for reporting. Will see how to fix this. Typing kubectl is painful, either get rid of it or support alias.

roffe commented 6 years ago

Here is some alias i use multiple times per day, might be usefull for some

My suggestion would be either implement support aliases of if not to much work, add a option in kube-shell where you can set your own name replacement for "kubectl" for example "kc" instead

Cheers!