-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#279 the main logic has been NOT changed! How ever this is some refac…
…toring and better logging
- Loading branch information
Showing
3 changed files
with
16 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,24 @@ | ||
import argparse | ||
|
||
DEFAULT_CONFIG_INI = 'config.ini' | ||
DEFAULT_SERVANT_DB = 'servant.db' | ||
|
||
|
||
def parse_args(): | ||
parser = argparse.ArgumentParser(description='Servant script for managing Rocksmith sessions.') | ||
parser.add_argument('-c', '--config', default='config.ini', | ||
parser.add_argument('-c', '--config', default=DEFAULT_CONFIG_INI, | ||
help='Path of the configuration file like: my_config.ini') | ||
parser.add_argument('-db', '--database', default='servant.db', | ||
parser.add_argument('-db', '--database', default=DEFAULT_SERVANT_DB, | ||
help='Path of the database file like: my_database.db') | ||
|
||
args = parser.parse_args() | ||
|
||
config = args.config | ||
if not config.endswith('.ini'): | ||
raise ValueError("The configuration file must have a '.ini' extension.") | ||
raise ValueError("The configuration file must end with an '.ini' extension! config: " + config) | ||
|
||
database = args.database | ||
if not database.endswith('.db'): | ||
raise ValueError("The database file must have a '.db' extension.") | ||
raise ValueError("The database file must end with an '.db' extension! database: " + database) | ||
|
||
return config, database |