along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
-import sys
-import json
-import functools
-import subprocess
-
USAGE = """
Usage:
- tty: Open TTY in GNU Screen
"""
-with open("config.json") as f:
- CONFIG = json.load(f)
+import sys
+import json
+import functools
+import subprocess
def open_ssh(server, command):
config = server["ssh"]
print(USAGE)
sys.exit(1)
-if len(sys.argv) != 3:
- die_with_usage("Incorrect number of arguments")
-
def get_server_handle(name):
try:
server = CONFIG["servers"][name]
callback(server)
+# Load configuration, get command, and go!
+
+with open("config.json") as f:
+ CONFIG = json.load(f)
+
+if len(sys.argv) != 3:
+ die_with_usage("Incorrect number of arguments")
+
issue_command(sys.argv[1], sys.argv[2])