segno icon indicating copy to clipboard operation
segno copied to clipboard

[feature request] Process input from file/standard input

Open m-ueberall opened this issue 3 years ago • 5 comments

In order to replace existing QR code generators, it would be helpful to be able to process input from a provided file and/or standard input as well (even though it's possible to store said input in an environment variable first, of course).

m-ueberall avatar Jan 07 '22 14:01 m-ueberall

Please provide an example which works with existing QR Code generators and which does not work with Segno.

heuer avatar Jan 14 '22 00:01 heuer

Is there a way to read input from files? For instance, cat input.txt | segno?

I am able to do this with python-qrcode (eg. cat input.txt | qr)

I tried this, which works but doesn't seem to encode newline characters into the QR code.

segno `cat input.txt`

1oh1 avatar Mar 23 '22 04:03 1oh1

I tried this, which works but doesn't seem to encode newline characters into the QR code.

segno `cat input.txt`

@1oh1 As a quick workaround, try segno "$(cat 'input.txt')" instead. The double quotes will ensure that the entire file contents are passed as a single argument, including newline characters (tested with Segno v1.4.1; of course, you can use backticks as well).

m-ueberall avatar Mar 23 '22 09:03 m-ueberall

Had a small patch that allows piping: https://github.com/rhyw/segno/pull/1

Broke some tests though. Haven't yet had much time to fix.

rhyw avatar Jul 22 '22 12:07 rhyw

Had a small patch that allows piping: rhyw#1

Broke some tests though. Haven't yet had much time to fix.

Thanks, I'll take a look

heuer avatar Jul 22 '22 15:07 heuer