Skip to content

Commit

Permalink
Add option '--version' to knowledge_repo script.
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Wardrop committed Oct 12, 2016
1 parent 27008cb commit e8c8753
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions scripts/knowledge_repo
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,14 @@ parser.add_argument('--knowledge-branch', dest='knowledge_branch', help='The bra
parser.add_argument('--dev', action='store_true', help='Whether to skip passing control to version of code checked out in knowledge repository.')
parser.add_argument('--debug', action='store_true', help='Whether to enable debug mode.')
parser.add_argument('--noupdate', dest='update', action='store_false', help='Whether script should update the repository before performing actions.')
parser.add_argument('--version', dest='version', action='store_true', help='Show version and exit.')
parser.add_argument('-h', '--help', action='store_true', help='Show help and exit.')

args, remaining_args = parser.parse_known_args()

if args.version:
print('Local version: {}'.format(knowledge_repo.__version__))

if args.help and not remaining_args:
parser.print_help()
sys.exit(0)
Expand Down Expand Up @@ -183,6 +187,10 @@ db_upgrade.add_argument('-c', '--config', default=None, help="The config file fr
db_upgrade.add_argument('-m', '--message', help="The message to use for the database revision.")
db_upgrade.add_argument('--autogenerate', action='store_true', help="Whether alembic should automatically populate the migration script.")

# Show version and exit
if args.version:
print('Embedded/active version: {}'.format(knowledge_repo.__version__))
sys.exit(0)

# Only show db_migrate option if running in development mode, and in a git repository.
if args.dev and os.path.exists(os.path.join(os.path.dirname(__file__), '..', '.git')):
Expand Down

0 comments on commit e8c8753

Please sign in to comment.