spcd/cd/__main__.py

18 lines
385 B
Python
Raw Normal View History

2024-04-26 21:10:58 +00:00
#! /usr/bin/env python3
2024-04-26 21:16:11 +00:00
import os
2024-04-26 21:10:58 +00:00
import sys
2024-04-26 19:58:35 +00:00
import cd
2024-06-08 21:56:21 +00:00
if __name__ == "__main__":
2024-04-26 21:55:20 +00:00
command, *arguments = sys.argv
2024-04-26 21:10:58 +00:00
command = os.path.basename(command)
2024-06-08 21:56:21 +00:00
if command == "__main__.py":
2024-06-01 18:14:06 +00:00
cd.set_ssh(*arguments)
2024-04-26 21:24:46 +00:00
cd.install_commands(__file__)
else:
2024-06-08 21:56:21 +00:00
command = command.replace("-", "_")
2024-04-26 21:55:20 +00:00
function = getattr(cd, command)
function(*arguments)