Open joehoyle opened 1 year ago
I don't know if it affects the implementation, but redirection should work too (as Joe and I chatted about earlier today). For example:
altis-cli stack ssh altis-demo -- wp user list > users.json
The end result is that users.json
gets saved on my local machine.
Just to note, you can do this in two commands if necessary:
altis-cli ssh altis-demo
wp user list > /tmp/users.json
altis-cli scp altis-demo:/tmp/users.json ./
User Story
As a CLI user I am able to pass a command to execute to
altis-cli stack ssh
such aswp user list
and then pipe the output to my local machine. For example, something likealtis-cli stack ssh altis-demo -- wp user list | grep joe
(in this casegrep
is being run on my local machine.I would also like to pipe data in to a command, for example:
echo joe | altis-cli stack ssh altis-demo -- wp user get
.I chatted to @rmccue about the feasibility to doing these, and there are a few low-level challenges that we need to overcome to be able to implement this. As I understand it:
ssh
is run, as currently it will output MOTD and other boilerplate as part of setting up the SSH sessions. If developers want to just be able to just run a command and pipe output, we can't have any of the initial data.wp user list
output PHP errors or any other error, it would be in stdout and piped along with the list of users. This makes the data useless in many situations. There's an open issue on https://github.com/aws/amazon-ssm-agent/issues/358 (2.5 years old) to address this, but it doesn't look like there's any progress.