Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
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
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
funkwhale
cli
Merge requests
!3
Ci
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Ci
ci
into
master
Overview
0
Commits
2
Pipelines
1
Changes
2
Merged
Agate
requested to merge
ci
into
master
6 years ago
Overview
0
Commits
2
Pipelines
1
Changes
2
Expand
Basic CI setup, fix
#6 (closed)
Edited
6 years ago
by
Agate
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
8a2bd964
2 commits,
6 years ago
2 files
+
81
−
47
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
funkwhale_cli/cli.py
+
62
−
47
Options
@@ -267,6 +267,7 @@ def get_ls_command(group, endpoint, output_conf):
@click.option
(
"
--ordering
"
,
"
-o
"
,
default
=
None
)
@click.option
(
"
--filter
"
,
"
-f
"
,
multiple
=
True
)
@click.option
(
"
--ids
"
,
"
-i
"
,
is_flag
=
True
)
@click.option
(
"
--limit
"
,
"
-l
"
,
type
=
click
.
INT
,
default
=
1
)
@click.option
(
"
--column
"
,
"
-c
"
,
@@ -289,61 +290,75 @@ def get_ls_command(group, endpoint, output_conf):
format
,
no_headers
,
ids
,
limit
,
):
if
ids
:
no_headers
=
True
column
=
[
output_conf
.
get
(
"
id_field
"
,
"
UUID
"
)]
format
=
"
plain
"
async
with
ctx
.
obj
[
"
remote
"
]:
params
=
{
"
page
"
:
page
}
if
page_size
:
params
[
"
page_size
"
]
=
page_size
if
ordering
:
params
[
"
ordering
"
]
=
ordering
if
query
:
params
[
"
q
"
]
=
"
"
.
join
(
query
)
if
filter
:
for
f
in
filter
:
query
=
urllib
.
parse
.
parse_qs
(
f
)
for
k
,
v
in
query
.
items
():
params
[
k
]
=
v
[
0
]
result
=
await
ctx
.
obj
[
"
remote
"
].
request
(
"
get
"
,
endpoint
,
params
=
params
)
result
.
raise_for_status
()
payload
=
await
result
.
json
()
if
raw
:
click
.
echo
(
json
.
dumps
(
payload
,
sort_keys
=
True
,
indent
=
4
))
else
:
click
.
echo
(
output
.
table
(
payload
[
"
results
"
],
column
or
output_conf
[
"
labels
"
],
type
=
output_conf
[
"
type
"
],
format
=
format
,
headers
=
not
no_headers
,
)
)
pagination_data
=
get_pagination_data
(
payload
)
if
pagination_data
[
"
page_size
"
]:
start
=
(
int
(
(
pagination_data
[
"
current_page
"
]
-
1
)
*
pagination_data
[
"
page_size
"
]
next_page_url
=
None
page_count
=
0
while
True
:
if
limit
and
page_count
>=
limit
:
break
async
with
ctx
.
obj
[
"
remote
"
]:
if
page_count
==
0
:
url
=
endpoint
params
=
{
"
page
"
:
page
}
if
page_size
:
params
[
"
page_size
"
]
=
page_size
if
ordering
:
params
[
"
ordering
"
]
=
ordering
if
query
:
params
[
"
q
"
]
=
"
"
.
join
(
query
)
if
filter
:
for
f
in
filter
:
query
=
urllib
.
parse
.
parse_qs
(
f
)
for
k
,
v
in
query
.
items
():
params
[
k
]
=
v
[
0
]
else
:
params
=
{}
url
=
next_page_url
if
not
url
:
break
result
=
await
ctx
.
obj
[
"
remote
"
].
request
(
"
get
"
,
url
,
params
=
params
)
result
.
raise_for_status
()
payload
=
await
result
.
json
()
next_page_url
=
payload
[
'
next
'
]
page_count
+=
1
if
raw
:
click
.
echo
(
json
.
dumps
(
payload
,
sort_keys
=
True
,
indent
=
4
))
else
:
click
.
echo
(
output
.
table
(
payload
[
"
results
"
],
column
or
output_conf
[
"
labels
"
],
type
=
output_conf
[
"
type
"
],
format
=
format
,
headers
=
not
no_headers
,
)
+
1
)
else
:
start
=
1
end
=
min
(
start
+
len
(
payload
[
"
results
"
])
-
1
,
payload
[
"
count
"
])
logs
.
logger
.
info
(
"
\n
Objects {start}-{end} on {total} (page {current_page}/{total_pages})
"
.
format
(
start
=
start
,
end
=
end
,
total
=
payload
[
"
count
"
],
current_page
=
pagination_data
[
"
current_page
"
],
total_pages
=
pagination_data
[
"
total_pages
"
]
or
1
,
pagination_data
=
get_pagination_data
(
payload
)
if
pagination_data
[
"
page_size
"
]:
start
=
(
int
(
(
pagination_data
[
"
current_page
"
]
-
1
)
*
pagination_data
[
"
page_size
"
]
)
+
1
)
else
:
start
=
1
end
=
min
(
start
+
len
(
payload
[
"
results
"
])
-
1
,
payload
[
"
count
"
])
logs
.
logger
.
info
(
"
\n
Objects {start}-{end} on {total} (page {current_page}/{total_pages})
"
.
format
(
start
=
start
,
end
=
end
,
total
=
payload
[
"
count
"
],
current_page
=
pagination_data
[
"
current_page
"
],
total_pages
=
pagination_data
[
"
total_pages
"
]
or
1
,
)
)
)
return
ls
Loading