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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Łukasz Nowak
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
Show 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 @@
import
ConfigParser
import
os
from
cliff
.command
import
Command
from
slapos.cli
.command
import
Command
class
ConfigError
(
Exception
):
...
...
slapos/cli/entry.py
View file @
535bc83e
...
...
@@ -22,6 +22,14 @@ class SlapOSCommandManager(cliff.commandmanager.CommandManager):
class
SlapOSApp
(
cliff
.
app
.
App
):
#
# self.options.verbose_level:
# -q -> 0
# -v -> 2
# -vv -> 3
# etc.
#
log
=
logging
.
getLogger
(
__name__
)
def
__init__
(
self
):
...
...
@@ -32,19 +40,25 @@ class SlapOSApp(cliff.app.App):
)
def
initialize_app
(
self
,
argv
):
if
self
.
options
.
verbose_level
>
2
:
self
.
log
.
debug
(
'initialize_app'
)
def
prepare_to_run_command
(
self
,
cmd
):
if
self
.
options
.
verbose_level
>
2
:
self
.
log
.
debug
(
'prepare_to_run_command %s'
,
cmd
.
__class__
.
__name__
)
def
clean_up
(
self
,
cmd
,
result
,
err
):
if
self
.
options
.
verbose_level
>
2
:
self
.
log
.
debug
(
'clean_up %s'
,
cmd
.
__class__
.
__name__
)
if
err
:
self
.
log
.
debug
(
'got an error: %s'
,
err
)
def
main
(
argv
=
sys
.
argv
[
1
:]):
app
=
SlapOSApp
()
if
not
argv
:
argv
=
[
'-h'
]
return
app
.
run
(
argv
)
...
...
slapos/cli/register.py
View file @
535bc83e
...
...
@@ -3,7 +3,7 @@
import
logging
import
sys
from
cliff
.command
import
Command
from
slapos.cli
.command
import
Command
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