diff options
author | Elrond <elrond+mediagoblin.org@samba-tng.org> | 2011-10-23 21:33:52 +0200 |
---|---|---|
committer | Elrond <elrond+mediagoblin.org@samba-tng.org> | 2011-10-23 21:33:52 +0200 |
commit | 15ac1458edfe703688cfe1e5eb36a2e90f5194c6 (patch) | |
tree | 00790769a85acd6e358e9fc5e5dfb6ddf757a1fe | |
parent | 9043e7a012c0b01a993e04831180005ff36730d6 (diff) | |
download | mediagoblin-15ac1458edfe703688cfe1e5eb36a2e90f5194c6.tar.lz mediagoblin-15ac1458edfe703688cfe1e5eb36a2e90f5194c6.tar.xz mediagoblin-15ac1458edfe703688cfe1e5eb36a2e90f5194c6.zip |
Make gmg's -cf option a global option
All gmg's subcommands used to have a -cf option to set the
config file. Instead make this a gmg global option.
This means:
bin/gmg migrate -cf mediagoblin_2.ini
gets
bin/gmg -cf mediagoblin_2.ini migrate
-rw-r--r-- | mediagoblin/gmg_commands/__init__.py | 3 | ||||
-rw-r--r-- | mediagoblin/gmg_commands/import_export.py | 2 | ||||
-rw-r--r-- | mediagoblin/gmg_commands/migrate.py | 3 | ||||
-rw-r--r-- | mediagoblin/gmg_commands/shell.py | 3 | ||||
-rw-r--r-- | mediagoblin/gmg_commands/users.py | 4 | ||||
-rw-r--r-- | mediagoblin/gmg_commands/util.py | 9 |
6 files changed, 5 insertions, 19 deletions
diff --git a/mediagoblin/gmg_commands/__init__.py b/mediagoblin/gmg_commands/__init__.py index 92ae840e..6c7450cb 100644 --- a/mediagoblin/gmg_commands/__init__.py +++ b/mediagoblin/gmg_commands/__init__.py @@ -58,6 +58,9 @@ SUBCOMMAND_MAP = { def main_cli(): parser = argparse.ArgumentParser( description='GNU MediaGoblin utilities.') + parser.add_argument( + '-cf', '--conf_file', default='mediagoblin.ini', + help="Config file used to set up environment") subparsers = parser.add_subparsers(help='sub-command help') for command_name, command_struct in SUBCOMMAND_MAP.iteritems(): diff --git a/mediagoblin/gmg_commands/import_export.py b/mediagoblin/gmg_commands/import_export.py index 5d39304a..78d30713 100644 --- a/mediagoblin/gmg_commands/import_export.py +++ b/mediagoblin/gmg_commands/import_export.py @@ -19,7 +19,6 @@ from mediagoblin.db.open import setup_connection_and_db_from_config from mediagoblin.init.config import read_mediagoblin_config from mediagoblin.storage.filestorage import BasicFileStorage from mediagoblin.init import setup_storage, setup_global_and_app_config -from mediagoblin.gmg_commands.util import option_add_conffile import shutil import tarfile @@ -40,7 +39,6 @@ def import_export_parse_setup(subparser): # TODO: Add default subparser.add_argument( 'tar_file') - option_add_conffile(subparser) subparser.add_argument( '--mongodump_path', default='mongodump', help='mongodump binary') diff --git a/mediagoblin/gmg_commands/migrate.py b/mediagoblin/gmg_commands/migrate.py index 0871a171..fad9b363 100644 --- a/mediagoblin/gmg_commands/migrate.py +++ b/mediagoblin/gmg_commands/migrate.py @@ -16,7 +16,6 @@ import sys -from mediagoblin.gmg_commands.util import option_add_conffile from mediagoblin.db import util as db_util from mediagoblin.db.open import setup_connection_and_db_from_config from mediagoblin.init.config import read_mediagoblin_config @@ -26,7 +25,7 @@ from mediagoblin.db import migrations def migrate_parser_setup(subparser): - option_add_conffile(subparser) + pass def _print_started_migration(migration_number, migration_func): diff --git a/mediagoblin/gmg_commands/shell.py b/mediagoblin/gmg_commands/shell.py index 408028d0..910560a0 100644 --- a/mediagoblin/gmg_commands/shell.py +++ b/mediagoblin/gmg_commands/shell.py @@ -19,11 +19,10 @@ import code from mediagoblin import mg_globals from mediagoblin.gmg_commands import util as commands_util -from mediagoblin.gmg_commands.util import option_add_conffile def shell_parser_setup(subparser): - option_add_conffile(subparser) + pass SHELL_BANNER = """\ diff --git a/mediagoblin/gmg_commands/users.py b/mediagoblin/gmg_commands/users.py index f6b03bf1..345c3e5c 100644 --- a/mediagoblin/gmg_commands/users.py +++ b/mediagoblin/gmg_commands/users.py @@ -15,7 +15,6 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. from mediagoblin.gmg_commands import util as commands_util -from mediagoblin.gmg_commands.util import option_add_conffile from mediagoblin.auth import lib as auth_lib from mediagoblin import mg_globals @@ -30,7 +29,6 @@ def adduser_parser_setup(subparser): subparser.add_argument( 'email', help="Email to recieve notifications") - option_add_conffile(subparser) def adduser(args): @@ -63,7 +61,6 @@ def makeadmin_parser_setup(subparser): subparser.add_argument( 'username', help="Username to give admin level") - option_add_conffile(subparser) def makeadmin(args): @@ -87,7 +84,6 @@ def changepw_parser_setup(subparser): subparser.add_argument( 'password', help="Your NEW supersecret word to login") - option_add_conffile(subparser) def changepw(args): diff --git a/mediagoblin/gmg_commands/util.py b/mediagoblin/gmg_commands/util.py index 02febd2c..168a0760 100644 --- a/mediagoblin/gmg_commands/util.py +++ b/mediagoblin/gmg_commands/util.py @@ -25,12 +25,3 @@ def setup_app(args): mgoblin_app = app.MediaGoblinApp(args.conf_file) return mgoblin_app - - -def option_add_conffile(subparser): - """ - Add the -cf option to a subparser - """ - subparser.add_argument( - '-cf', '--conf_file', default='mediagoblin.ini', - help="Config file used to set up environment") |