parent
76840937d1
commit
fbf4141fb3
2 changed files with 12 additions and 3 deletions
|
@ -1,7 +1,14 @@
|
|||
import os
|
||||
|
||||
COMMANDS_PREFIX = 'cd-'
|
||||
|
||||
|
||||
def cd_list_environment:
|
||||
for variable, value in os.environ:
|
||||
print(variable, value)
|
||||
|
||||
|
||||
def install_commands(path):
|
||||
user = '/usr/local/bin'
|
||||
for command in ['list-environment']:
|
||||
os.symlink(path, os.path.join(user, f'cd-{command}'))
|
||||
os.symlink(path, os.path.join(user, f'{COMMANDS_PREFIX}{command}'))
|
||||
|
|
|
@ -7,9 +7,11 @@ import cd
|
|||
|
||||
|
||||
if __name__ == '__main__':
|
||||
command, *_ = sys.argv
|
||||
command, *arguments = sys.argv
|
||||
command = os.path.basename(command)
|
||||
if command == '__main__.py':
|
||||
cd.install_commands(__file__)
|
||||
else:
|
||||
print(command)
|
||||
command = command.replace('-', '_')
|
||||
function = getattr(cd, command)
|
||||
function(*arguments)
|
||||
|
|
Loading…
Reference in a new issue