-
Notifications
You must be signed in to change notification settings - Fork 118
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
Add explicit flag to read from standard input #242
Conversation
Fixes bug introduced in zk-org#240 where interactive use of `zk new` results in the command sitting indefinitely for user to supply user input. This change introduces an explicit flag to `new` to indicate standard input should be read for the content of the note. The flag is called `-i` on `--input`. The flag name is somewhat confusing as there is a `--no-input` flag at the global level. I propose that we change that flag name to `--no-prompt` as it more accurately describes the option. To maintain backwards compatibility, we define `--no-input` as an alias.
Apparently, kong `aliases` are only for commands. It did not work as I had expected. At this point, `--no-input` has been removed. If we want to keep it for backwards compatibility, I suppose we could add a new hidden command line arg called `--no-input`. I defer to you for your thoughts.
Apparently, kong |
Thanks for tackling this! I'd like to keep the This interactive mode for I'll need to check if there's a way to read all available stdin input without blocking until Ctrl-D, that would be a nicer behavior when By the way, did you change anything in the SVG screencast? It appears as changed in the "Files changed" tab: docs/assets/media/list-format.svg |
Yes,
I don't think it's common for a CLI tool to selectively choose when to read from stdin based on whether the data is coming from a pipe or not, so I'm not sure we need to, but in the spirit of backwards compatibility, it certainly doesn't hurt.
I don't believe there is any standard means to do so.
Yes, in the screen shot, there was a |
Thank you, that would be great 🙏 |
This reverts commit e2b9225.
This reverts commit c4ed7c0.
This option instructs the `new` command to read the initial contents of the note from standard input. This allows the use to pipe or use shell redirection with note creation: ```sh $ zk new --interactive < file.txt $ echo "Initial content" | zk new --interactive ```
With the last commits, I've undone the prior changes and only added the Upon thinking about our earlier discussion, I really believe that This becomes even more apparent when one reads It also simplifies the code without needing to add back Finally, regarding $ make tesh
CGO_ENABLED=1 go build -tags "fts5" -ldflags "-X=main.Version=`git describe --tags --match v[0-9]* 2> /dev/null` -X=main.Build=`git rev-parse --short HEAD`"
usage: tesh [-h] [--cd some/directory] [--setenv var=value] [--cfg arg] [--log arg] [--ignore-jenkins] [--wrapper arg] [--keep] [teshfile]
tesh: error: unrecognized arguments: tests/fixtures
make: *** [tesh] Error 2
$ tesh -h
usage: tesh [-h] [--cd some/directory] [--setenv var=value] [--cfg arg] [--log arg] [--ignore-jenkins] [--wrapper arg] [--keep] [teshfile]
tesh -- testing shell
optional arguments:
-h, --help show this help message and exit
Options:
teshfile Name of teshfile, stdin if omitted
--cd some/directory ask tesh to switch the working directory before launching the tests
--setenv var=value set a specific environment variable
--cfg arg add parameter --cfg=arg to each command line
--log arg add parameter --log=arg to each command line
--ignore-jenkins ignore all cruft generated on SimGrid continuous integration servers
--wrapper arg Run each command in the provided wrapper (eg valgrind)
--keep Keep the obtained output when it does not match the expected one
$ brew info simgrid
simgrid: stable 3.31 (bottled) |
Re: tesh, I just realized it was your tool. I should have look at the GitHub workflows earlier. Doh! |
Okay, in the hopes you agree with my prior comment and to help persuade you further, I've updated all the tesh tests where content was piped into |
Oh, and to further sweeten the pot, I also updated the screencasts where you pipe content into |
You convinced me, that's a sound argument.
Ha yes, and it's a pretty experimental tool. I thought go-cmdtest was interesting but needed something a bit more flexible. |
Fantastic! |
Fixes bug introduced in #240 where interactive use of
zk new
resultsin the command sitting indefinitely for user to supply user input.
This change introduces an explicit flag to
new
to indicate standardinput should be read for the content of the note. The flag is called
-i
on--input
.The flag name is somewhat confusing as there is a
--no-input
flag atthe global level. I propose that we change that flag name to
--no-prompt
as it more accurately describes the option. To maintainbackwards compatibility, we define
--no-input
as an alias.