python-cmd2 / cmd2

cmd2 - quickly build feature-rich and user-friendly interactive command line applications in Python
https://cmd2.readthedocs.io/en/stable/
MIT License
606 stars 113 forks source link

Completely ignore redirection characters leaving the line "as is" #1305

Open acorbe opened 2 months ago

acorbe commented 2 months ago

Hi all,

I am wondering how disable any parsing of redirection commands.

I am aware of the feature allow_redirection. If set to False, redirection symbols and whatever follows are ignored.

However, here, I'd like to achieve another behavior that is "a redirection symbols (and follow-ups) are passed over as-is" to the do_command line.

Any strategy?

Thanks

kmvanbrunt commented 2 months ago

You can quote the redirection characters on the command line.

Are you using argparse-decorated command functions?

acorbe commented 2 months ago

I currently use a combination of "cmd1" and paramiko to have distributed ssh shell.

The commands in the cmd shell are forwarded to the ssh client pool.
Hence, in my use-case, redirection characters are meant for the ssh client pool rather than for the current host.

I'd like to migrate from cmd to cmd2.
Having the possibility to just forward redirection symbols is what bottlenecks the migration.

Hope this clarifies my context.