Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
rwm
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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Radoslav Bodó
rwm
Commits
a337a5c0
Commit
a337a5c0
authored
1 year ago
by
Radoslav Bodó
Browse files
Options
Downloads
Patches
Plain Diff
rwm: add version subcommand
parent
ebd84457
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
rwm.py
+3
-0
3 additions, 0 deletions
rwm.py
tests/test_default.py
+1
-1
1 addition, 1 deletion
tests/test_default.py
with
4 additions
and
1 deletion
rwm.py
+
3
−
0
View file @
a337a5c0
...
@@ -155,6 +155,7 @@ def main(argv=None):
...
@@ -155,6 +155,7 @@ def main(argv=None):
parser
.
add_argument
(
"
--config
"
,
default
=
"
rwm.conf
"
)
parser
.
add_argument
(
"
--config
"
,
default
=
"
rwm.conf
"
)
subparsers
=
parser
.
add_subparsers
(
title
=
"
commands
"
,
dest
=
"
command
"
,
required
=
False
)
subparsers
=
parser
.
add_subparsers
(
title
=
"
commands
"
,
dest
=
"
command
"
,
required
=
False
)
version_cmd_parser
=
subparsers
.
add_parser
(
"
version
"
,
help
=
"
show version
"
)
aws_cmd_parser
=
subparsers
.
add_parser
(
"
aws
"
,
help
=
"
aws command
"
)
aws_cmd_parser
=
subparsers
.
add_parser
(
"
aws
"
,
help
=
"
aws command
"
)
aws_cmd_parser
.
add_argument
(
"
cmd_args
"
,
nargs
=
"
*
"
)
aws_cmd_parser
.
add_argument
(
"
cmd_args
"
,
nargs
=
"
*
"
)
rc_cmd_parser
=
subparsers
.
add_parser
(
"
rclone
"
,
help
=
"
rclone command
"
)
rc_cmd_parser
=
subparsers
.
add_parser
(
"
rclone
"
,
help
=
"
rclone command
"
)
...
@@ -172,6 +173,8 @@ def main(argv=None):
...
@@ -172,6 +173,8 @@ def main(argv=None):
# assert config ?
# assert config ?
rwmi
=
RWM
(
config
)
rwmi
=
RWM
(
config
)
if
args
.
command
==
"
version
"
:
print
(
__version__
)
if
args
.
command
==
"
aws
"
:
if
args
.
command
==
"
aws
"
:
return
wrap_output
(
rwmi
.
aws_cmd
(
args
.
cmd_args
))
return
wrap_output
(
rwmi
.
aws_cmd
(
args
.
cmd_args
))
if
args
.
command
==
"
rclone
"
:
if
args
.
command
==
"
rclone
"
:
...
...
This diff is collapsed.
Click to expand it.
tests/test_default.py
+
1
−
1
View file @
a337a5c0
...
@@ -42,7 +42,7 @@ def test_main(tmpworkdir: str): # pylint: disable=unused-argument
...
@@ -42,7 +42,7 @@ def test_main(tmpworkdir: str): # pylint: disable=unused-argument
# optional and default config hanling
# optional and default config hanling
assert
rwm_main
([])
==
0
assert
rwm_main
([])
==
0
Path
(
"
rwm.conf
"
).
touch
()
Path
(
"
rwm.conf
"
).
touch
()
assert
rwm_main
([])
==
0
assert
rwm_main
([
"
version
"
])
==
0
# command branches
# command branches
mock
=
Mock
(
return_value
=
CompletedProcess
(
args
=
'
dummy
'
,
returncode
=
0
))
mock
=
Mock
(
return_value
=
CompletedProcess
(
args
=
'
dummy
'
,
returncode
=
0
))
...
...
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