There is code in `main.go` for reading/writing stdin/out. However, it
was non-functional. This was because the code was checking to see if
`opts.Names` was `nil`, when in fact it is a zero-length slice (the only
paths that return `nil` for `opts.Names` are those involving errors, the
version flag, or the help flag).
This feature is currently not
documented anywhere in the help output or man page, and it probably
should be.
If you'd like me to add some documentation for it, or to
bump the version, let me know.
Michelle S (1):
Fix stdin/stdout not working
main.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--
2.32.0
From: Michelle S <alterae@protonmail.com>
`options.ParseArgs` returns [] for opts if no files are specified, not
`nil`. This commit changes the relevant logic to check for that,
allowing reading from standard input and writing to standard output.
---
main.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/main.go b/main.go
index 1706531..5a59207 100644
--- a/main.go+++ b/main.go
@@ -35,7 +35,7 @@ func main() {
}
// Use stdin if no filenames were given.
- if opts.Names == nil {+ if len(opts.Names) == 0 { err = Convert(os.Stdin, os.Stdout, opts.GemOptions)
if err != nil {
log.Fatalf("failed converting STDIN: %v\n", err)
--
2.32.0
Thanks for the fix! I saw your email yesterday and was gonna look into
it, but you beat me to it. I updated the docs and pushed out a new
version with your fix. If you run into any other issues or questions
feel free to drop a message here; there's a number of features I'd still
like to add before a version 1.0.