Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
buildstream
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
Privacy statement
Keyboard shortcuts
?
What's new
6
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
BuildStream
buildstream
Commits
2ca28df6
Commit
2ca28df6
authored
6 years ago
by
richardmaw-codethink
Browse files
Options
Downloads
Patches
Plain Diff
cli: Add artifact list subcommand
parent
f169bcce
No related branches found
Branches containing commit
No related tags found
1 merge request
!1008
WIP: Add artifact checkout, list, list-contents, delete and diff subcommands
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
buildstream/_frontend/cli.py
+24
-0
24 additions, 0 deletions
buildstream/_frontend/cli.py
with
24 additions
and
0 deletions
buildstream/_frontend/cli.py
+
24
−
0
View file @
2ca28df6
...
...
@@ -150,6 +150,8 @@ def override_completions(cmd, cmd_param, args, incomplete):
complete_list
=
complete_target
(
args
,
incomplete
)
complete_list
.
extend
(
complete_artifact
(
args
,
incomplete
))
return
complete_list
if
cmd_param
.
name
==
'
artifact_prefix
'
:
return
complete_artifact
(
args
,
incomplete
)
raise
CompleteUnhandled
()
...
...
@@ -1188,6 +1190,28 @@ def artifact_delete(app, artifacts):
cache
.
cas
.
remove
(
ref
,
defer_prune
=
(
i
!=
len
(
artifacts
)))
#################################################################
# Artifact List Command #
#################################################################
@artifact.command
(
name
=
'
list
'
,
short_help
=
"
List artifacts that match the prefix
"
)
@click.option
(
'
--null
'
,
'
-z
'
,
default
=
False
,
is_flag
=
True
,
help
=
"
Separate tokens with NUL bytes instead of newlines
"
)
@click.argument
(
'
artifact_prefix
'
,
type
=
click
.
Path
(),
nargs
=-
1
)
@click.pass_obj
def
artifact_list
(
app
,
null
,
artifact_prefix
):
"""
List artifact refs that match the prefix
"""
sentinel
=
'
\0
'
if
null
else
'
\n
'
with
app
.
initialized
():
cas
=
app
.
context
.
artifactcache
.
cas
prefixes
=
_classify_artifact_refs
(
artifact_prefix
,
cas
)
print
(
sentinel
.
join
(
ref
for
ref
in
cas
.
list_refs
()
if
any
(
ref
.
startswith
(
pfx
)
for
pfx
in
prefixes
)),
end
=
sentinel
)
##################################################################
# DEPRECATED Commands #
##################################################################
...
...
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