Changing workspace clobber option directly from Pe

2020-03-21 01:59发布

How to change perforce specs from command line? What I want to do is, i have a workspace whose clobber option is set to noclobber(default value). Now i want to change it to clobber.

I know we can do it directly from p4v, but i dont want that. I also know that if we run 'p4 client' command in cmd, it will open P4CONFIG file in text editor, where we can change noclobber to clobber and save the file and its done, but i also dont want that too.

Please tell me the specific command which directly changes the noclobber to clobber without using p4v or without editing P4CONFIG.txt.

Thanks and Regards, Noob perforce admin

3条回答
够拽才男人
2楼-- · 2020-03-21 02:46

If you're trying to avoid repeatedly opening a text editor, you can accomplish your goal with a little bit of sed, like this:

p4 client -o | \
sed 's/ noclobber/ clobber/' | \
p4 client -i
查看更多
Lonely孤独者°
3楼-- · 2020-03-21 02:55

Simplest solution:

P4EDITOR='sed -i s/noclobber/clobber/' p4 client
查看更多
Fickle 薄情
4楼-- · 2020-03-21 02:58

It's pretty easy to script this with Perl, Python, Ruby, or even Powershell. Here's a one-liner in Powershell:

p4 client -o | %{$_ -replace "noclobber", "clobber"} | p4 client -i

查看更多
登录 后发表回答