Jump to content


cmooand line: adding control characters to descriptions

commandline control characters newline tab non-printing characters

  • Please log in to reply
3 replies to this topic

#1 Miles O'Neal

Miles O'Neal

    Advanced Member

  • Members
  • PipPipPip
  • 79 posts

Posted 04 October 2018 - 03:39 PM

A user wants to generate a client or modify a client from the command line with a multi-line description field. Ideally this could be done with

% p4 --field "Description=new\n\tline" client -o newline_test |  p4 client -i

For now we have a workaround of:

%  p4 --field "Description=fred" client -o newline_test | sed -e 's/fred/new\n\tline/' |  p4 client -i

I'm assuming there's a way to do this without the intermediate sed step, but haven't been able to find it online or through experimentation.

Thanks!

#2 Sambwise

Sambwise

    Advanced Member

  • Members
  • PipPipPip
  • 612 posts

Posted 04 October 2018 - 04:23 PM

That'd be a pretty trivial change to make in the p4 CLI (you can do this via "--field Field+=blah" for certain types of field, like the View), but you'd need to maintain your own CLI build then.  I don't think there's a built-in way to do this.

#3 Sambwise

Sambwise

    Advanced Member

  • Members
  • PipPipPip
  • 612 posts

Posted 04 October 2018 - 05:45 PM

Specifically, I think right here:

https://swarm.worksh...tuserdbg.cc#231

the line to add would be
if ( elem->IsText() ) value.Append( "\n" );

so that an append (+=) operation on a multi-line text field always appends on a new line.

#4 Miles O'Neal

Miles O'Neal

    Advanced Member

  • Members
  • PipPipPip
  • 79 posts

Posted 04 October 2018 - 11:03 PM

Ugh. We'd rather stick with supported software. Thanks!





Also tagged with one or more of these keywords: commandline, control characters, newline, tab, non-printing characters

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users