softlayer / softlayer-python

A set of Python libraries that assist in calling the SoftLayer API.
http://softlayer.github.io/softlayer-python/
MIT License
152 stars 195 forks source link

Apparently no way to enter new lines in ticket body when creating ticket via slcli? #900

Closed ulyssesbbg closed 4 years ago

ulyssesbbg commented 6 years ago

For example:

slcli ticket create --title='TESTING - please ignore' --subject-id=1021 --body="Hello, we are testing to see if tickets can be '\n' created via slcli with line breaks '\n' in them for easier reading. There should be a line break here \n too. If you know of a way to do so via the slcli tool, please let us know. '\n\n' Thanks! '\n'

Expected Behavior

New lines inserted where \n or '\n' exists.

Actual Behavior

One long paragraph, with \n interpreted literally.

Environment Information

Operating System: macOS High Sierra 10.13.1 (17B1003) slcli (SoftLayer Command-line), version 5.0.1

Am I using the wrong syntax or should this be possible? Softlayer's customer service tech asked if I could post here as she did not know how and nobody she asked knew either. I couldn't find specific mention of newlines at ticket creation time in the docs or code either.

allmightyspiff commented 4 years ago

I know its been 3 years since you asked this question, but I finally got around to fixing it.

Newlines in the --body argument are going to be represented literally (as \n), and thats a side effect of how they are pulled out of the command line. Instead of regex-ing them back, I decided to allow for STDIN input as a sort of middle solution, for both ticket creation and updates. I've also updated the documentation to make this a lot more clear. Previously just omitting --body would open up a text editor so you could make nice updates, but that wasn't mentioned in the docs anywhere.

slcli ticket update 123456 --body="Some text"

Will update the ticket with Some text. Newlines here will show up literally.

cat sometfile.txt | slcli ticket update 123456

Will update the ticket with text from STDIN. This is the new behavior.

slcli ticket update 123456

Will open the default text editor, and once closed, use that text to update the ticket. Existed on old versions, but a bit better documented now.

Same applies for slcli ticket create