diff --git a/cd/__init__.py b/cd/__init__.py index 61b0830..bc54d6a 100644 --- a/cd/__init__.py +++ b/cd/__init__.py @@ -1,5 +1,7 @@ import os -def install_commands(): - os.symlink(__file__, '/usr/local/bin/cd-list-environment') +def install_commands(path): + user = '/usr/local/bin' + for command in ['list-environment']: + os.symlink(path, os.path.join(user, f'cd-{command}') diff --git a/cd/__main__.py b/cd/__main__.py index 7835eef..50e77b6 100755 --- a/cd/__main__.py +++ b/cd/__main__.py @@ -8,7 +8,8 @@ import cd if __name__ == '__main__': command, *_ = sys.argv - print(command) command = os.path.basename(command) - print(command) - cd.install_commands() + if command == '__main__.py': + cd.install_commands(__file__) + else: + print(command)