Discussion
Done
-
2022-01-21:
-
With files named:
a*b
andaab
,chars a*b
now works correctly -
Case folding for Windows only is somewhat implemented in case.go
-
- This can be disabled by the
-s
switch; thus allowing for character classes in between a set of[]
- This can be disabled by the
-
- PRs to improve this are most welcomed
-
chars.OutputTextTable()
now returns an error when output can not be displayed: -
- Example:
chars /dev/null > /dev/full
- Example:
-
Added to
README.md
: -
- Use
<
redirection when possible instead of|
- Use
-
- Using
Get-Content -AsByteStream
with newer versions of powershell
- Using
-
- Under powershell, consider using
curl --output
- Under powershell, consider using
-
When reading file chunks, the block size has been changed from
1024
to4096
-- a small performance improvement -
chars.searchForSpecialChars()
has been rewritten to be significantly more performant. -
2022-01-19:
-
chars
is now a package, with a correspondingcmd/chars/cmd.go
for the CLI interface -
This will now report special chars for STDIN
-
- cat filename | chars -
-
Running
chars
by itself with no cmd-line args will also read from STDIN -
A
BytesRead
column was added to the output -
- Depending on how data is piped into
chars
(and which OS), values can differ vs reading the same filename from the cmd-line. See below
- Depending on how data is piped into
-
If a glob doesn't match any files, no output or error will occur
-
Added
-j
output to create JSON format -
I think globbing is fixed for cross-platform.
-
- I am still globbing because I want this feature for Windows, but since Linux bash, macOS zsh already expand file names beforehand this should not cause a problem.
-
- The program is able to handle files on Linux actually containing a
*
in their name.
- The program is able to handle files on Linux actually containing a
-
- Please let me know if you can think of any problems that may arise with this method.
-
It reads files in chunks as to not consume too much memory.
To Do
On Windows, filenames are case-sensitive, but expected behavior is case-insensitiveChecking for errors when writing output has only been implemented for json output and not fortable.Render()
I am not very happy withsearchForSpecialChars()
. It works, but seems kludgy -- how could this be function be simplified?You mentioned "paths are a tricky business". I'm OK if my program does not work for unconventional, non-standard file names.- Create
chars_test.go
once everything has been stabilized. - Create API examples in
README.md
Reading from STDIN on Windows
- YMMV when piping to
STDIN
under Windows cmd
andpowershell
will skipBOM
characters; these 2 fields will both report a value of0
cmd
andpowershell
will skipNUL
characters; this field report a value of0
cmd
will convertLF
toCRLF
forUTF-16
encoded filespowershell
will convertLF
toCRLF
- Piping from programs such as
curl
will returnLF
characters undercmd
, butCRLF
underpowershell