Dne 10.1.2016 v 03:30 Pavel Raiskup napsal(a):
---
cli/copr | 25 +++++++++++++++++++++++++
cli/copr_cli/main.py | 9 ++++++---
2 files changed, 31 insertions(+), 3 deletions(-)
create mode 100755 cli/copr
diff --git a/cli/copr b/cli/copr
new file mode 100755
index 0000000..a119b23
--- /dev/null
+++ b/cli/copr
@@ -0,0 +1,25 @@
+#! /bin/sh
+
+# Run copr-cli script directly from git.
I do not want to support running copr-cli directly from git. What is the
benefit? If you want to test then commit your work, run "tito build
--rpm --test -i" and test is exactly how user will use it.
class Commands(object):
- def __init__(self):
+ def __init__(self, config):
try:
- self.client = CoprClient.create_from_file_config()
+ self.client = CoprClient.create_from_file_config(config)
except (copr_exceptions.CoprNoConfException,
copr_exceptions.CoprConfigException):
print(no_config_warning)
@@ -295,6 +295,9 @@ def setup_parser():
parser.add_argument("--debug", dest="debug",
action="store_true",
help="Enable debug output")
+ parser.add_argument("--config", dest="config",
+ help="Path to an alternative configuration file")
+
subparsers = parser.add_subparsers(title="actions")
# create the parser for the "list" command
@@ -422,7 +425,7 @@ def main(argv=sys.argv[1:]):
if arg.debug:
enable_debug()
- commands = Commands()
+ commands = Commands(arg.config)
getattr(commands, arg.func)(arg)
except KeyboardInterrupt:
On the other hand this one is useful.
Can you please split it?
Mirek