mmctl icon indicating copy to clipboard operation
mmctl copied to clipboard

Trim command line input

Open anx-ag opened this issue 1 year ago • 1 comments

Hey,

we stumbled upon an issue today where mmctl would throw strange error message when trying to bulk add users to a channel. At the end it turns out that the input file format had \r\n line endings.

# od -c demo.txt
0000000   s   o   m   e   o   n   e   @   s   o   m   e   w   h   e   r
0000020   e   .   c   o   m  \r  \n

The error message when trying to add this user via mmctl then was:

# cat demo.txt | xargs -L1 mmctl channel users add main:change-management
'an't find user '[email protected]

After removing the carriage returns from the input file, it worked without issues, but I think it would be good to just strip/trim the command line input of mmctl and remove possible carriage returns directly (I think that there's no situation where you would want to work with them anyways).

Thanks, Alex

anx-ag avatar Sep 19 '22 06:09 anx-ag