feat: add new options to parser
@@ -5,6 +5,7 @@ import optparse
import sys
import mamonsu.lib.platform as platform
+from mamonsu.lib.parser import MissOptsParser
from mamonsu.plugins.pgsql.driver.checks import is_conn_to_db
from mamonsu import __version__ as mamonsu_version
from mamonsu.lib.default_config import DefaultConfig
@@ -15,7 +16,7 @@ from mamonsu.tools.bootstrap.sql import CreateSchemaSQL, GrantsOnSchemaSQL, Quer
class Args(DefaultConfig):
def __init__(self):
- parser = optparse.OptionParser(
+ parser = MissOptsParser(
usage='%prog bootstrap -M <MAMONSU USERNAME> <DBNAME>',
version='%prog bootstrap {0}'.format(mamonsu_version),
description='Bootstrap DDL for monitoring')
@@ -28,12 +29,12 @@ class Args(DefaultConfig):
default=self.default_db(),
help='database name to connect to (default: %default)')
group.add_option(
- '--host',
+ '-h', '--host',
dest='hostname',
default=self.default_host(),
help='database server host or socket path (default: %default)')
group.add_option(
- '--port',
+ '-p', '--port',
dest='port',
default=self.default_port(),
help='database server port (default: %default)')
@@ -64,6 +65,7 @@ class Args(DefaultConfig):
self.args, commands = parser.parse_args()
print(self.args)
+ print(commands)
if len(commands) > 0:
if len(commands) == 1:
self.args.dbname = commands[0]
@@ -143,7 +145,6 @@ class Args(DefaultConfig):
def run_deploy():
-
args = Args()
if not args.try_configure_connect_to_pg():
sys.exit(1)
