Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cc-cli
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirror
cc-cli
Commits
6d53c823
Commit
6d53c823
authored
14 years ago
by
Seblu
Browse files
Options
Downloads
Patches
Plain Diff
commands tags use TqlCommand
parent
24b00270
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cccli/command/tag.py
+10
-19
10 additions, 19 deletions
cccli/command/tag.py
with
10 additions
and
19 deletions
cccli/command/tag.py
+
10
−
19
View file @
6d53c823
...
...
@@ -8,31 +8,22 @@ CloudControl tag releated commands
from
cccli.exception
import
*
from
sjrpc.core.exceptions
import
*
from
cccli.printer
import
Printer
,
color
from
cccli.command.command
import
OptionCommand
,
TqlCommand
from
cccli.command.command
import
TqlCommand
from
optparse
import
OptionParser
class
Command_tags
(
Option
Command
):
'''
List static tags
on an account
'''
class
Command_tags
(
Tql
Command
):
'''
List
only
static tags
'''
def
__init__
(
self
,
cli
,
argv0
):
Option
Command
.
__init__
(
self
,
cli
,
argv0
)
Tql
Command
.
__init__
(
self
,
cli
,
argv0
)
self
.
set_usage
(
"
%prog [options] [tql]
"
)
self
.
add_option
(
"
--raw
"
,
action
=
"
store_true
"
,
dest
=
"
raw
"
,
help
=
"
Don
'
t append filter on request
"
)
self
.
add_option
(
"
-n
"
,
"
--no-tagdisplay
"
,
action
=
"
store_false
"
,
dest
=
"
tagdisplay
"
,
default
=
True
,
help
=
"
No tag display system
"
)
def
__call__
(
self
,
argv
):
# Parse argline
self
.
parse_args
(
argv
)
# handle tagdisplay
if
self
.
options
.
tagdisplay
:
self
.
td
=
self
.
cli
.
tagdisplay
.
resolve
self
.
tc
=
self
.
cli
.
tagdisplay
.
color
else
:
self
.
td
=
lambda
tagname
,
tagvalue
:
unicode
(
tagvalue
)
self
.
tc
=
lambda
tagname
:
color
[
"
reset
"
]
# append current login if nothing asked
if
len
(
self
.
args
)
==
0
:
tql
=
"
a=%s
"
%
self
.
cli
.
settings
[
"
login
"
]
...
...
@@ -43,18 +34,18 @@ class Command_tags(OptionCommand):
tql
+=
"
&a
"
# ask server
try
:
objs
=
self
.
cli
.
rpc
.
call
(
"
tags
"
,
tql
)
objs
=
self
.
rpccall
(
"
tags
"
,
tql
,
_status
=
False
)
except
RpcError
as
e
:
raise
cmdError
(
"
RPCError: %s
"
%
str
(
e
))
# display answer
for
o
in
objs
:
id
=
self
.
td
(
"
id
"
,
o
.
pop
(
"
id
"
))
tags
=
"
"
.
join
([
"
%s%s:%s%s
"
%
(
color
[
"
reset
"
]
,
t
id
=
self
.
td
r
(
"
id
"
,
o
.
pop
(
"
id
"
))
tags
=
"
"
.
join
([
"
%s%s:%s%s
"
%
(
self
.
tdtc
(
t
)
,
t
,
self
.
tc
(
t
),
self
.
td
(
t
,
v
))
self
.
t
d
c
(
t
),
self
.
td
r
(
t
,
v
))
for
(
t
,
v
)
in
o
.
items
()
])
self
.
printer
.
out
(
"
%sid
:
%s%s %s%s
"
%
(
color
[
"
reset
"
],
color
[
"
lblue
"
]
,
id
,
tags
,
color
[
"
reset
"
]))
self
.
printer
.
out
(
"
%sid
=
%s%s %s%s
"
%
(
self
.
tdtc
(
"
id
"
),
self
.
tdc
(
"
id
"
)
,
t
id
,
tags
,
color
[
"
reset
"
]))
class
Command_addtag
(
TqlCommand
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment