Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cc-cli
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
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
80c6bf0f
Commit
80c6bf0f
authored
13 years ago
by
Matthieu Gonnet
Committed by
Seblu
13 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add watch command
parent
98a60864
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cccli/commands/watch.py
+36
-0
36 additions, 0 deletions
cccli/commands/watch.py
with
36 additions
and
0 deletions
cccli/commands/watch.py
0 → 100644
+
36
−
0
View file @
80c6bf0f
#!/usr/bin/env python
#coding=utf8
'''
CloudControl watch command
'''
import
time
as
systime
from
cccli.exception
import
*
from
sjrpc.core.exceptions
import
*
from
cccli.printer
import
Printer
,
color
from
cccli.command
import
OptionCommand
class
Command_watch
(
OptionCommand
):
'''
Show output of a repeated command
'''
def
__init__
(
self
,
cli
,
argv0
):
OptionCommand
.
__init__
(
self
,
cli
,
argv0
)
self
.
set_usage
(
"
%prog [options] command [options]
"
)
self
.
add_option
(
"
-n
"
,
"
--interval
"
,
dest
=
"
seconds
"
,
type
=
"
float
"
,
default
=
1.0
,
help
=
"
Define interval in seconds
"
)
def
__call__
(
self
,
argv
):
# Parse argline
self
.
parse_args
(
argv
)
if
len
(
self
.
args
)
==
0
:
raise
cmdBadArgument
()
while
True
:
self
.
args
=
self
.
cli
.
aliases
.
substitute
(
self
.
args
)
# Clear tty
self
.
cli
.
commands
([
"
clear
"
])
# Execute command
self
.
cli
.
commands
(
self
.
args
)
systime
.
sleep
(
self
.
options
.
seconds
)
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