From b92ec04039420ad3d6ff0a5e8fbfb54f2192128b Mon Sep 17 00:00:00 2001 From: "Darren T. Davis II" Date: Mon, 3 Oct 2022 12:09:20 -0400 Subject: [PATCH] update homepath call for win support update main func for AttributeError handling --- cbn_cli.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/cbn_cli.py b/cbn_cli.py index bb44d08..7080ceb 100755 --- a/cbn_cli.py +++ b/cbn_cli.py @@ -34,8 +34,8 @@ from googleapiclient import _auth AUTHORIZATION_SCOPES = ['https://www.googleapis.com/auth/chronicle-backstory'] -DEFAULT_CREDS_FILE_PATH = os.path.join(os.environ['HOME'], - '.chronicle_credentials.json') +DEFAULT_CREDS_FILE_PATH = os.path.join(os.path.expanduser('~'), + 'chronicle_credentials.json') # URLs for Chronicle CBN API endpoints. CHRONICLE_API_V1_URL = 'https://backstory.googleapis.com/v1' @@ -557,4 +557,13 @@ def main(input_args): if __name__ == '__main__': - main(sys.argv[1:]) + try: + main(sys.argv[1:]) + except AttributeError: + time.sleep(1) + print(f"The command was incorrect or did not contain a function to run. Please see \"help\" by running the command \"python cbn_cli.py --help\"\n\n\n") + time.sleep(1) + if len(sys.argv) == 1: + parser = arg_parser() + parser.print_help() + sys.exit(1) \ No newline at end of file