summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorxiubuzhe <xiubuzhe@sina.com>2023-10-15 03:40:31 +0800
committerxiubuzhe <xiubuzhe@sina.com>2023-10-15 03:40:31 +0800
commit98fae3427e6791003e64572a2a6ca317c72473ef (patch)
tree38a109b70b029beb9b4bec71206762126e43dacb /bin
parent4e3722353878da15ea9017190b462a3883ecc2d2 (diff)
downloadsunhpc-98fae3427e6791003e64572a2a6ca317c72473ef.tar.gz
sunhpc-98fae3427e6791003e64572a2a6ca317c72473ef.tar.bz2
sunhpc-98fae3427e6791003e64572a2a6ca317c72473ef.zip
add bash-completion in /sbin/sunhpc-compxxxx-bak
Diffstat (limited to 'bin')
-rwxr-xr-xbin/completions-sunhpc.py31
-rwxr-xr-xbin/sunhpc1
2 files changed, 32 insertions, 0 deletions
diff --git a/bin/completions-sunhpc.py b/bin/completions-sunhpc.py
new file mode 100755
index 0000000..d2bd4b6
--- /dev/null
+++ b/bin/completions-sunhpc.py
@@ -0,0 +1,31 @@
+#!/opt/sunpy3/bin/python3
+
+import os
+import sys
+
+
+cword = int(os.environ['COMP_CWORD'])
+cwords = os.environ['COMP_WORDS'].split()
+cline = os.environ['COMP_LINE']
+#curr = os.environ['COMP_CURR']
+
+if 'sunhpc' in cwords:
+ cwords.remove('sunhpc')
+
+
+commands = '/opt/sunhpc/lib/sunhpc/commands/'
+modules = commands + '/'.join(cwords)
+if os.path.exists(modules):
+ cmdpath = os.listdir(modules)
+else:
+ cmdpath = os.listdir(commands)
+
+print (modules)
+print ('-------------------------------')
+print(' '.join(cmdpath))
+#print("candaidate1 candbidate2")
+
+#print ('\n-cword---%s---' % cword)
+#print ('\n-cwords--%s---' % cwords)
+#print ('\n-cline---%s---' % cline)
+#print ('\n-curr----%s---' % sys.argv)
diff --git a/bin/sunhpc b/bin/sunhpc
index bab4e54..de4dac7 100755
--- a/bin/sunhpc
+++ b/bin/sunhpc
@@ -6,6 +6,7 @@ import sys
import sunhpc
import syslog
import shutil
+import readline
import sunhpc.invoke
if sys.getdefaultencoding() != 'utf-8':