summaryrefslogtreecommitdiffstats
path: root/bin/completions-sunhpc.py
blob: d2bd4b6c236502934ffef16bb9c6c263750ee4ff (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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)