Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
18
Merge Requests
18
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos.core
Commits
535bc83e
Commit
535bc83e
authored
Apr 29, 2013
by
Marco Mariani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
provide -h by default; handle multiline help; multiple verbose levels
parent
836dc719
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
5 deletions
+35
-5
slapos/cli/command.py
slapos/cli/command.py
+16
-0
slapos/cli/config.py
slapos/cli/config.py
+1
-1
slapos/cli/entry.py
slapos/cli/entry.py
+17
-3
slapos/cli/register.py
slapos/cli/register.py
+1
-1
No files found.
slapos/cli/command.py
0 → 100644
View file @
535bc83e
# -*- coding: utf-8 -*-
import
argparse
import
cliff
class
Command
(
cliff
.
command
.
Command
):
def
get_parser
(
self
,
prog_name
):
parser
=
argparse
.
ArgumentParser
(
description
=
self
.
get_description
(),
prog
=
prog_name
,
formatter_class
=
argparse
.
RawTextHelpFormatter
)
return
parser
slapos/cli/config.py
View file @
535bc83e
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
import
ConfigParser
import
ConfigParser
import
os
import
os
from
cliff
.command
import
Command
from
slapos.cli
.command
import
Command
class
ConfigError
(
Exception
):
class
ConfigError
(
Exception
):
...
...
slapos/cli/entry.py
View file @
535bc83e
...
@@ -22,6 +22,14 @@ class SlapOSCommandManager(cliff.commandmanager.CommandManager):
...
@@ -22,6 +22,14 @@ class SlapOSCommandManager(cliff.commandmanager.CommandManager):
class
SlapOSApp
(
cliff
.
app
.
App
):
class
SlapOSApp
(
cliff
.
app
.
App
):
#
# self.options.verbose_level:
# -q -> 0
# -v -> 2
# -vv -> 3
# etc.
#
log
=
logging
.
getLogger
(
__name__
)
log
=
logging
.
getLogger
(
__name__
)
def
__init__
(
self
):
def
__init__
(
self
):
...
@@ -32,19 +40,25 @@ class SlapOSApp(cliff.app.App):
...
@@ -32,19 +40,25 @@ class SlapOSApp(cliff.app.App):
)
)
def
initialize_app
(
self
,
argv
):
def
initialize_app
(
self
,
argv
):
self
.
log
.
debug
(
'initialize_app'
)
if
self
.
options
.
verbose_level
>
2
:
self
.
log
.
debug
(
'initialize_app'
)
def
prepare_to_run_command
(
self
,
cmd
):
def
prepare_to_run_command
(
self
,
cmd
):
self
.
log
.
debug
(
'prepare_to_run_command %s'
,
cmd
.
__class__
.
__name__
)
if
self
.
options
.
verbose_level
>
2
:
self
.
log
.
debug
(
'prepare_to_run_command %s'
,
cmd
.
__class__
.
__name__
)
def
clean_up
(
self
,
cmd
,
result
,
err
):
def
clean_up
(
self
,
cmd
,
result
,
err
):
self
.
log
.
debug
(
'clean_up %s'
,
cmd
.
__class__
.
__name__
)
if
self
.
options
.
verbose_level
>
2
:
self
.
log
.
debug
(
'clean_up %s'
,
cmd
.
__class__
.
__name__
)
if
err
:
if
err
:
self
.
log
.
debug
(
'got an error: %s'
,
err
)
self
.
log
.
debug
(
'got an error: %s'
,
err
)
def
main
(
argv
=
sys
.
argv
[
1
:]):
def
main
(
argv
=
sys
.
argv
[
1
:]):
app
=
SlapOSApp
()
app
=
SlapOSApp
()
if
not
argv
:
argv
=
[
'-h'
]
return
app
.
run
(
argv
)
return
app
.
run
(
argv
)
...
...
slapos/cli/register.py
View file @
535bc83e
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
import
logging
import
logging
import
sys
import
sys
from
cliff
.command
import
Command
from
slapos.cli
.command
import
Command
from
slapos.register.register
import
do_register
,
RegisterConfig
from
slapos.register.register
import
do_register
,
RegisterConfig
...
...
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