Skip to content

Commit

Permalink
Renamed 'interactive mode' to 'paused mode'.
Browse files Browse the repository at this point in the history
  • Loading branch information
guilhermechapiewski committed Oct 6, 2009
1 parent c4fddd0 commit af5f3e9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
5 changes: 3 additions & 2 deletions src/__init__.py
Expand Up @@ -28,10 +28,11 @@ def run():
config.put('show_sql_only', options.show_sql_only)
config.put('new_migration', options.new_migration)
config.put('drop_db_first', options.drop_db_first)
config.put('interactive_mode', options.interactive_mode)
config.put('paused_mode', options.paused_mode)

# paused mode forces log_level to 2
log_level = int(options.log_level)
if options.interactive_mode:
if options.paused_mode:
log_level = 2

config.put('log_level', log_level)
Expand Down
12 changes: 6 additions & 6 deletions src/cli.py
Expand Up @@ -36,12 +36,6 @@ def __config_parser(self):
default="simple-db-migrate.conf",
help="Use a specific config file. If not provided, will search for 'simple-db-migrate.conf' in the current directory.")

self.__parser.add_option("-i", "--interactive",
action="store_true",
dest="interactive_mode",
default=False,
help="Execute in interactive mode. In this mode you will need to press <enter> key in order to execute each SQL command, making it easier to see what is being executed and helping debug. When interactive mode is enabled, log level is automatically set to [2].")

self.__parser.add_option("-l", "--log-level",
dest="log_level",
default=1,
Expand All @@ -57,6 +51,12 @@ def __config_parser(self):
default=None,
help="Create migration file with the given nickname. The nickname should contain only lowercase characters and underscore '_'. Example: 'create_table_xyz'.")

self.__parser.add_option("-p", "--paused-mode",
action="store_true",
dest="paused_mode",
default=False,
help="Execute in 'paused' mode. In this mode you will need to press <enter> key in order to execute each SQL command, making it easier to see what is being executed and helping debug. When interactive mode is enabled, log level is automatically set to [2].")

self.__parser.add_option("-v", "--version",
action="store_true",
dest="simple_db_migrate_version",
Expand Down
4 changes: 2 additions & 2 deletions src/main.py
Expand Up @@ -104,8 +104,8 @@ def execute_migrations(self, current_version, destination_version, is_migration_

self.mysql.change(sql, migration_version, is_migration_up, execution_log=log)

# interactive mode
if self.config.get("interactive_mode"):
# paused mode
if self.config.get("paused_mode"):
try:
raw_input("* press <enter> to continue... ")
except KeyboardInterrupt:
Expand Down
4 changes: 2 additions & 2 deletions tests/cli_test.py
Expand Up @@ -35,8 +35,8 @@ def test_it_should_configure_all_options(self):
self.assertTrue(parser.has_option("-l"))
self.assertTrue(parser.has_option("--log-level"))

self.assertTrue(parser.has_option("-i"))
self.assertTrue(parser.has_option("--interactive"))
self.assertTrue(parser.has_option("-p"))
self.assertTrue(parser.has_option("--paused-mode"))

def test_it_should_show_error_message_and_exit(self):
cli = CLI()
Expand Down

0 comments on commit af5f3e9

Please sign in to comment.