Easier and more self documenting patterns for loading/saving Persistent
[python_utils.git] / orb_utils.py
1 #!/usr/bin/env python3
2
3 # © Copyright 2021-2022, Scott Gasch
4
5 """Utilities related to changing the orb's color."""
6
7 import os
8
9 import config
10
11 parser = config.add_commandline_args(
12     f"Orb Utils ({__file__})",
13     "Args having to do with controlling Scott's Orb.",
14 )
15 parser.add_argument(
16     "--orb_utils_file_location",
17     default="/Users/scott/orb_color",
18     metavar="FILENAME",
19     type=str,
20     help="The location of the orb file on whatever machine is hosting it.",
21 )
22 parser.add_argument(
23     "--orb_utils_user_machine",
24     default="[email protected]",
25     metavar="USER@HOSTNAME",
26     type=str,
27     help="The username/machine combo that is hosting the orb.",
28 )
29
30
31 def make_orb(color: str) -> None:
32     """Make the orb on my desk a particular color."""
33     user_machine = config.config['orb_utils_user_machine']
34     orbfile_path = config.config['orb_utils_file_location']
35     os.system(f"ssh {user_machine} 'echo \"{color}\" > {orbfile_path}'")