How to get “Client name:” of a perforce workspace

2019-08-14 22:30发布

I have a scenario where i need to have perforce workspace Client name information. Trying out with script as follows:

    import sys
    import subprocess
    cmd = "p4 info | grep" + """ "Client name" """ +""
    print ("p4 command is: ",cmd)
    p4 = subprocess.call(cmd)
    print( p4)       

Where i get out put as :

    p4 command is: p4 info | grep "Client name"
    Usage: info [-s]
    Unexpected arguments.
    1

I tried doing as follows too but did not worked:

    import sys
    import subprocess
    p4_info = subprocess.call([sys.executable, "p4 info | grep "Client name""])

I actually want to fetch only Client name information. So, suggest me how i may have that. If there is another way of doing it please suggest. The script will be executed within the workspace and shall return the only Client name:

1条回答
太酷不给撩
2楼-- · 2019-08-14 22:44

Do:

p4 -Ztag -F %clientName% info
查看更多
登录 后发表回答