Skip to main content
1-Visitor
May 4, 2016
Solved

How to get labels for a project using CLI

  • May 4, 2016
  • 1 reply
  • 2175 views

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 ??

    Best answer by tdalon

    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

    1 reply

    tdalon1-VisitorAnswer
    1-Visitor
    May 4, 2016

    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

    12-Amethyst
    October 28, 2016

    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?