summaryrefslogtreecommitdiffstats
path: root/gamechestcli/__main__.py
diff options
context:
space:
mode:
Diffstat (limited to 'gamechestcli/__main__.py')
-rwxr-xr-xgamechestcli/__main__.py20
1 files changed, 18 insertions, 2 deletions
diff --git a/gamechestcli/__main__.py b/gamechestcli/__main__.py
index 1497e40..8fe912d 100755
--- a/gamechestcli/__main__.py
+++ b/gamechestcli/__main__.py
@@ -4,12 +4,17 @@ Manage games. Install, remove, run them.
Usage: gamechest install <GAME_ID>
gamechest remove <GAME_ID>
- gamechest run --profile_id=<PROFILE_ID> <GAME_ID>
+ gamechest run [--profile_id=<PROFILE_ID>] <GAME_ID>
+ gamechest set [--profile_id=<PROFILE_ID>] [--remote_basedir=<BASEDIR>] [--gamesaves_path]
+
'''
+import sys
+
import docopt
from gamechest.cliactions import install, remove, run
+from gamechest.gameconfig import config
def main():
@@ -21,7 +26,18 @@ def main():
elif args['remove']:
remove.remove(args['<GAME_ID>'])
elif args['run']:
- run.run(args['<GAME_ID>'], args['--profile_id'])
+ profile_id = args['--profile_id'] or config.get_profile_id()
+ if not profile_id:
+ print('profile_id must be not null', file=sys.stderr)
+ run.run(args['<GAME_ID>'], profile_id)
+ elif args['set']:
+ if args['--profile_id']:
+ config.set_profile_id(args['--profile_id'])
+ if args['--remote_basedir']:
+ config.set_remote_basedir(args['--remote_basedir'])
+ if args['--gamesaves_path']
+ config.set_gamesaves_path(args['--gamesaves_path'])
+ config.save()
if __name__ == "__main__":