summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Bartosh <eduard.bartosh@intel.com>2014-03-30 00:31:52 +0200
committerEd Bartosh <eduard.bartosh@intel.com>2014-04-01 11:11:05 +0300
commit1f1a7c0a0a65667f906d32335b4a0e684a871c86 (patch)
tree42dda95abd45200d2e4189d4bfbd85d858201847
parent43a275bd5c0fb3a4c34a39643931bee9cbe7edbb (diff)
downloadrepa-1f1a7c0a0a65667f906d32335b4a0e684a871c86.tar.gz
repa-1f1a7c0a0a65667f906d32335b4a0e684a871c86.tar.bz2
repa-1f1a7c0a0a65667f906d32335b4a0e684a871c86.zip
Make project mandatory config option
As --project option was mandatory in most of the subcommands let's make project mandatory config option. --project becomes non-mandatory global option. Fixes: #1763 Change-Id: Id7f94fc5d60a1d163bde614ecf0605f944448337 Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
-rw-r--r--repa.138
-rw-r--r--repa/accept.py2
-rwxr-xr-xrepa/group.py2
-rwxr-xr-xrepa/info.py2
-rwxr-xr-xrepa/main.py6
-rw-r--r--repa/reject.py2
-rw-r--r--repa/rmgroup.py2
7 files changed, 11 insertions, 43 deletions
diff --git a/repa.1 b/repa.1
index 2638e89..f16cb9b 100644
--- a/repa.1
+++ b/repa.1
@@ -61,6 +61,13 @@ Print \fIrepa\fR version and exit.
Print short help text and exit.
.RE
+.PP
+.B \-p, \-\-project PROJECT
+.RS 2
+Target OBS project.
+.RE
+
+
.\" ===========================================================================
.\" Commands descriptions
.\" ===========================================================================
@@ -170,13 +177,6 @@ Package build failures:
Print short help text about the "info" command and exit.
.RE
-.PP
-\-p, \-\-project PROJECT
-.RS 2
-Target project name. Mandatory option.
-.RE
-
-
.\"
.\" The "accept" command description
.\"
@@ -198,12 +198,6 @@ Print short help text about the "accept" command and exit.
.RE
.PP
-\-p, \-\-project PROJECT
-.RS 2
-Target project name. Mandatory option.
-.RE
-
-.PP
\-comment COMMENT
.RS 2
Add acceptance comment to created SRs.
@@ -230,12 +224,6 @@ Print short help text about the "reject" command and exit.
.RE
.PP
-\-p, \-\-project PROJECT
-.RS 2
-Target project name. Mandatory option.
-.RE
-
-.PP
\-comment COMMENT
.RS 2
Add rejection comment to created SRs.
@@ -267,12 +255,6 @@ Print short help text about the "group" command and exit.
.RE
.PP
-\-p, \-\-project PROJECT
-.RS 2
-Target project name. Mandatory option.
-.RE
-
-.PP
\-comment COMMENT
.RS 2
Add comment to created submit group. It will be shown by list command.
@@ -303,12 +285,6 @@ Remove submit group.
Print short help text about the "rmgroup" command and exit.
.RE
-.PP
-\-p, \-\-project PROJECT
-.RS 2
-Target project name. Mandatory option.
-.RE
-
.SH BUGS
Please, report bugs to Ed Bartosh <eduard.bartosh@intel.com>.
diff --git a/repa/accept.py b/repa/accept.py
index e76e84d..8292f24 100644
--- a/repa/accept.py
+++ b/repa/accept.py
@@ -47,8 +47,6 @@ class Accept(object):
def add_arguments(parser, _config):
"""Adds arguments to the parser. Called from [sub_]main."""
parser.add_argument('submission', help='submission or group')
- parser.add_argument('-p', '--project', help='target project',
- required=True)
parser.add_argument('-c', '--comment', help='comment', default='')
@staticmethod
diff --git a/repa/group.py b/repa/group.py
index 3b087b1..25be5ab 100755
--- a/repa/group.py
+++ b/repa/group.py
@@ -164,8 +164,6 @@ class Group(object):
"""Adds arguments to the parser. Called from [sub_]main."""
parser.add_argument('submission', nargs='+',
help='space separated list of submissions')
- parser.add_argument('-p', '--project', help='target project',
- required=True)
parser.add_argument('-c', '--comment', help='comment', default='')
parser.add_argument('-f', '--force', action='store_true',
help='force group creation')
diff --git a/repa/info.py b/repa/info.py
index baa4089..7de8739 100755
--- a/repa/info.py
+++ b/repa/info.py
@@ -143,8 +143,6 @@ class Info(object):
Set defaults for arguments from config.
"""
parser.add_argument('submission', help='submission or group')
- parser.add_argument('-p', '--project', help='target project',
- required=True)
@staticmethod
def run(argv):
diff --git a/repa/main.py b/repa/main.py
index d5cf03d..4517777 100755
--- a/repa/main.py
+++ b/repa/main.py
@@ -59,7 +59,9 @@ def parse_args(argv):
version='%(prog)s version 0.2~0.dev')
parser.add_argument('-s', '--section', default='general',
help='config section to use')
- # Define subcommands using setup.py entry points
+ parser.add_argument('-p', '--project', help='target project',
+ default=config.get('project'))
+
subparsers = parser.add_subparsers(help='sub-command help')
for entry in pkg_resources.iter_entry_points(group='repa_commands'):
cmd = entry.load()()
@@ -77,7 +79,7 @@ def parse_args(argv):
def read_config(paths=('/etc/repa.conf', expanduser('~/.repa.conf')),
section='general',
- mandatory=('apiurl', 'apiuser', 'apipasswd')):
+ mandatory=('apiurl', 'apiuser', 'apipasswd', 'project')):
"""
Read repa config.
Configuration is read from the set of files provided.
diff --git a/repa/reject.py b/repa/reject.py
index 4ee8d78..a907740 100644
--- a/repa/reject.py
+++ b/repa/reject.py
@@ -47,8 +47,6 @@ class Reject(object):
def add_arguments(parser, _config):
"""Adds arguments to the parser. Called from [sub_]main."""
parser.add_argument('submission', help='submission or group')
- parser.add_argument('-p', '--project', help='target project',
- required=True)
parser.add_argument('-c', '--comment', help='comment', default='')
@staticmethod
diff --git a/repa/rmgroup.py b/repa/rmgroup.py
index edbe73f..c3eac2a 100644
--- a/repa/rmgroup.py
+++ b/repa/rmgroup.py
@@ -56,8 +56,6 @@ class RmGroup(object):
def add_arguments(parser, _config):
"""Adds arguments to the parser. Called from [sub_]main."""
parser.add_argument('group', help='group of submissions')
- parser.add_argument('-p', '--project', help='target project',
- required=True)
@staticmethod
def run(argv):