Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
jetconf
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
7
Issues
7
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
labs
jetconf
Commits
a32338e3
Commit
a32338e3
authored
Jun 30, 2017
by
Pavel Spirek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Jetconf reports its version
parent
1cf1a327
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
6 deletions
+23
-6
jetconf/__main__.py
jetconf/__main__.py
+23
-6
No files found.
jetconf/__main__.py
View file @
a32338e3
...
...
@@ -6,7 +6,7 @@ import sys
import
signal
from
importlib
import
import_module
from
pkg_resources
import
resource_string
from
pkg_resources
import
resource_string
,
get_distribution
from
colorlog
import
error
,
info
from
yaml.parser
import
ParserError
...
...
@@ -21,6 +21,13 @@ from .config import CONFIG_GLOBAL, CONFIG_NACM, load_config, validate_config, pr
from
.helpers
import
ErrorHelpers
def
print_help
():
print
(
"Jetconf command line options:"
)
print
(
"-c [config file] | Pass the configuration file in YAML format"
)
print
(
"-v | Print version info"
)
print
(
"-h | Display this help"
)
def
main
():
config_file
=
"config.yaml"
...
...
@@ -29,19 +36,26 @@ def main():
print
(
"Jetconf requires Python version 3.5 or higher"
)
sys
.
exit
(
1
)
# Get Jetconf version
jetconf_version
=
get_distribution
(
"jetconf"
)
.
version
# Parse command line arguments
try
:
opts
,
args
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
"c:v"
)
opts
,
args
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
"c:v
h
"
)
except
getopt
.
GetoptError
:
print
(
"Invalid argument detected. Possible options are:"
)
print
(
"-c [config file] | Pass the configuration file in YAML format"
)
print
(
"-v | Print version info"
)
print
(
"-h | Display this help"
)
print
(
"Error: invalid argument detected."
)
print_help
()
sys
.
exit
(
1
)
for
opt
,
arg
in
opts
:
if
opt
==
"-c"
:
config_file
=
arg
elif
opt
==
"-v"
:
print
(
"Jetconf version {}"
.
format
(
jetconf_version
))
sys
.
exit
(
0
)
elif
opt
==
"-h"
:
print_help
()
sys
.
exit
(
0
)
# Load configuration
try
:
...
...
@@ -120,6 +134,9 @@ def main():
logger
.
addHandler
(
log_handler
)
logger
.
setLevel
(
log_level
)
# Print version
info
(
"Jetconf version {}"
.
format
(
jetconf_version
))
# Print configuration
print_config
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment