cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

How to get labels for a project using CLI

pdilliraja
1-Visitor

How to get labels for a project using CLI

Hi all

I want to know a command on how to retrieve all labels of a particular project.

I tried the following command, but it is displaying the labels for the elements present inside that project.

  si viewproject --project=/src/somethingproject.pj --fields=labels > labels.txt

i want to get the labels from project level.

can anyone please provide suggestion or do i need to use any filters ??

ACCEPTED SOLUTION

Accepted Solutions
tdalon
12-Amethyst
(To:pdilliraja)

Hi

you shall use si viewprojecthistory instead of si viewproject

Example here: si viewprojecthistory --project=$MKS.pj --fields=labels,revision --rfilter=labeled

Kind regards.

Thierry

View solution in original post

2 REPLIES 2
tdalon
12-Amethyst
(To:pdilliraja)

Hi

you shall use si viewprojecthistory instead of si viewproject

Example here: si viewprojecthistory --project=$MKS.pj --fields=labels,revision --rfilter=labeled

Kind regards.

Thierry

kthierer
12-Amethyst
(To:tdalon)

For those who want to parse or import the output from Thierrys tip

it might be interresting to know that the fileds are separated by a TAB character.

(BTW: the command also outputs 2 empy lines, which is not that ideal for parsing)

Something offtopic

In my efforts finding a method for a easy parseable format for the information where my (sub)sandbox points to

i stumbled over viewprojecthistory which outputs only the server location if the filter has no matches:

c:\sand\prj1>si viewprojecthistory -S project.pj --rfilter=labeled:A_LABEL_THAT_WILL_NEVER_EXIST

This will output

d:/my/server/project/path/project.pj

Thierry, do you know a better more elegant way?

Announcements


Top Tags