Skip to content
Browse files

start fixing autocomplete

  • Loading branch information...
1 parent 54f9ecb commit de80fbb6447abe522b50042f271fdac04359acde @stepler stepler committed Jun 22, 2012
Showing with 17 additions and 14 deletions.
  1. +5 −5 argparser.py
  2. +1 −1 bash_completion/geeknote
  3. +11 −8 geeknote.py
View
10 argparser.py
@@ -264,7 +264,7 @@ def printAutocomplete(self):
# печатаем корневые команды
if self.CMD is None:
- self.printGrid(CMD_LIST)
+ self.printGrid(self.CMD_LIST)
# работа с корневыми командами
elif not self.INP:
@@ -282,12 +282,12 @@ def printAutocomplete(self):
else:
# фильтруем аргументы которые еще не ввели
- if self.CMD_ARGS.has_key(PREV_LAST_VAL) or self.CMD_FLAGS.has_key(LAST_VAL) :
- printGrid([item for item in ARGS_FLAGS_LIST if item not in INP])
+ # if PREV_LAST_VAL in ARGS_FLAGS_LIST or LAST_VAL in ARGS_FLAGS_LIST: # self.CMD_ARGS.has_key(PREV_LAST_VAL) or self.CMD_FLAGS.has_key(LAST_VAL) :
+ self.printGrid([item for item in ARGS_FLAGS_LIST if item not in self.INP])
# автозаполнение для неполной команды
elif not self.CMD_ARGS.has_key(PREV_LAST_VAL):
- self.printGrid([item for item in ARGS_FLAGS_LIST if item not in INP and item.startswith(LAST_VAL)])
+ self.printGrid([item for item in ARGS_FLAGS_LIST if item not in self.INP and item.startswith(LAST_VAL)])
# обработка аргумента
else:
@@ -330,4 +330,4 @@ def printHelp(self):
if self.CMD_FLAGS:
out.printLine("Available flags:")
for flag in self.CMD_FLAGS:
- out.printLine("%s : %s" % (flag.rjust(tab, " "), self.CMD_FLAGS[flag]['help']))
+ out.printLine("%s : %s" % (flag.rjust(tab, " "), self.CMD_FLAGS[flag]['help']))
View
2 bash_completion/geeknote
@@ -5,7 +5,7 @@ _geeknote_command()
SAVE_IFS=$IFS
IFS=" "
- args="${COMP_WORDS[*]}"
+ args="${COMP_WORDS[*]:1}"
IFS=$SAVE_IFS
COMPREPLY=( $(compgen -W "`geeknote autocomplete ${args}`" -- ${cur}) )
View
19 geeknote.py
@@ -5,6 +5,15 @@
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
sys.path.append( os.path.join(PROJECT_ROOT, 'lib') )
+import config
+
+try:
+ if not os.path.exists(config.APP_DIR):
+ os.mkdir(config.APP_DIR)
+except Exception, e:
+ logging.error("Can not create application dirictory.")
+ tools.exit()
+
import hashlib
import binascii
import time
@@ -21,7 +30,7 @@
import signal
import out
-import config
+
from argparser import argparser
from oauth import GeekNoteAuth
from storage import Storage
@@ -30,12 +39,7 @@
from log import logging
-try:
- if not os.path.exists(config.APP_DIR):
- os.mkdir(config.APP_DIR)
-except Exception, e:
- logging.error("Can not create application dirictory.")
- tools.exit()
+
def GeekNoneDBConnectOnly(func):
def wrapper(*args, **kwargs):
@@ -656,7 +660,6 @@ def modifyArgsByStdinStream():
def main():
-
# if terminal
if sys.stdin.isatty():
sys_argv = sys.argv[1:]

0 comments on commit de80fbb

Please sign in to comment.
Something went wrong with that request. Please try again.