Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stdin redirection? #1036

Closed
laf0rge opened this issue Jan 10, 2021 · 4 comments
Closed

stdin redirection? #1036

laf0rge opened this issue Jan 10, 2021 · 4 comments

Comments

@laf0rge
Copy link
Contributor

laf0rge commented Jan 10, 2021

it's very nice that one can redirect the output of some command to a file.

However, in order to have symmetric operation, one would also have to be able to use stdin redirection, i.e. start a command which then receives stdin from a file.

stdin from a file is one step, the second - even better - step would be the ability to 'pipe' the output of a shell command into the stdin of a built-in cmd2 command.

@tleonhardt
Copy link
Member

@laf0rge Thanks for the suggestions. Certainly the ability to pipe the output a a shell command or cmd2 command into another cmd2 command would be useful and we already have issue #978 that covers that suggestion.

The ability to use stdin redirection is a separate request and we can look into the possibility and keep this issue open for that.

Actually, a long time ago cmd2 had this capability, but nobody was using it and when we rearchitected it to use a much higher performance command parser we removed the stdin redirection capability because it made the parsing logic simpler and faster. But we can revist the possibility of adding it back. Perhaps there is a smart and efficient way to do it which we hadn't considered previously.

@laf0rge
Copy link
Contributor Author

laf0rge commented Feb 2, 2021

I was quite excited when I heard that this issue was closed, and the feature already implemented.. However, looking at the actual code changes linked here, I think there was a mistake. I cannot find any stdin related code in it?

@tleonhardt
Copy link
Member

Re-opening this because I'm 98% sure that @anselor intended to close #1037 and just had an off-by-1 error in his commit message

@tleonhardt tleonhardt reopened this Feb 2, 2021
@tleonhardt
Copy link
Member

@laf0rge We would welcome PRs to implement this feature, but it's not a feature that any of the core cmd2 developers are excited about implementing at this time. So I'm going to close this issue. But please feel free to submit a PR if you have a good idea for how to implement this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants