6 ms·
You can also specify filenames and, of course, use shell wild cards However, some may be slow to render (like PDF), so lsix doesn't show them unless you ask sp
by userbinator 8y ago
You can also specify filenames and, of course, use shell wild cards
However, some may be slow to render (like PDF), so lsix doesn't show them unless you ask specifically.
Regardless of the justification, I don't think creating such extra exception/edge-case behaviours are ever a good idea in a commandline tool like this. The equivalent in regular ls would be something like not showing more than X files "unless you ask specifically" --- which would just create more confusion than anything. As someone who has used the commandline for many years, one property which needs to be present for good usability is consistency. Having a bunch of edge-cases and special behaviours makes a tool hard to use for anything but the most extremely basic of operations.
- pvg 8y agols does not show files starting with .
- binarysaurus 8y agoBut there is a driving purpose behind that, hidden vs non-hidden is binary. With so many media formats I agree that consistency is very important.
- ndnxhs 8y agoThe reason is because it was a lazy hack to hide . and .. from ls and then people started using this behaviour to hide files.
- pvg 8y agoIt's still largely arbitrary. I'm pushing back against the general notion that standard Unix-y command line tools are some shining example of consistency. Most of it is just us confusing familiarity for consistency.
- Wowfunhappy 8y agoThere are some edge cases, but those cases are well-known and simple to understand.
- pvg 8y agoIf you haven't run across it before, google up The Unix-Haters Handbook for an entertaining book-length rebuttal.
- hn_throwaway_99 8y agoYeah, but those files are known as "hidden files". In other words, it is the creators of those files who purposefully prepend them with a . to hide them from ls and other tools. One can argue whether this "starting with a . means hidden" is a hack or not, but I think it's manifestly different than not showing particular file types based on size or something like that. I agree just not showing pdf files by default because they render slowly is a design mistake.
- pvg 8y agoThe thing I'm getting at is not whether one behaviour or another is 'right' - just that they are both inconsistent so in this case 'consistency' is probably not the right design criterion on which to base this criticism.
- tobinfricke 8y ago> One can argue whether this "starting with a . means hidden" is a hack or not The story from Rob Pike is that this came about from a combination of (1) not wanting to show "." and "..", and (2) some sloppy programming in the implementation of that feature. https://plus.google.com/+RobPikeTheHuman/posts/R58WgWwN9jp https://plus.google.com/+RobPikeTheHuman/posts/R58WgWwN9jp
- scarejunba 8y agoIt doesn't matter. These are smart defaults. Just like ripgrep uses gitignore files by default. It makes my normal use useful.
- jake_the_third 8y ago> It doesn't matter. Why? I, like gp, prefer consistency and predictability over unique tool-specific defaults. If every command line tool had it's own special quirks, I would need to consult man pages every single time I issue something more complex that a `cd`. Perhaps lsix should be separated into two tools like find and locate; one that uses cached rendered previews and the other generates them on the fly.
- deleted 8y ago[deleted]
- vthriller 8y agoPredictability is a tad subjective (I'll put consistency part aside for a moment here); e.g. you can think of pdf handling this way: lsix is about images first and foremost, so it makes sense to hide everything else, including pdfs, which are mostly books and papers and other things that thumbnails would hardly even help with. (This reasoning, however, becomes more brittle once we include videos into equation. Should it be images-only tool, or should it be about anything thumbnailable?)
- ObsoleteNerd 8y agoAre PDFs really expected to preview in an image viewer though? I don't really think of them as images, so I see the flag to preview them as more of an "extra feature", which is exactly what flags are for. If it didn't preview GIFs without a flag, or PNGs, then your point would absolutely stand.
- kijin 8y agoExactly. PDFs are documents, not images. Just because ImageMagick can convert PDFs into images doesn't make them images. Every image viewer on Earth excludes DOCs and PPTs by default, but nobody complains about that.
- deleted 8y ago[deleted]
- TeMPOraL 8y agoI recall at least one vector drawing program offering PDF as target, and this being expected in some print shops, so yes, in some cases, PDFs can be images. PDF is a weird format with a bunch of disjoint use cases.
- a1369209993 8y agoGIMP offers ASCII art as a target, and that's expected by line printers/teletypewriters; does that mean TXTs can be images?
- aasasd 8y agoRegular `ls` lists files in a variable number of columns depending on the terminal width. Many utils enable or disable color output depending on the destination of that output, and on terminal's capabilities. CLI utils are full of special behaviors for convenience of use by people. To enable strict consistence that is mostly necessary for usage by other programs, there are flags.
- Cogito 8y agoMany CLI tools will detect if they are running in an interactive shell and change their output accordingly. Git for example will colourise terminal output if it can tell a person is interacting with it, but if a script is calling then the colour markers won't be added (and there are many many other examples of similar behaviour).
- laumars 8y agoThe moment you pipe ‘ls’ it will fallback to using just one column. In fact a great deal of CLI tools (and particularly coreutils like GNU) will have nice usability features this will auto-disable the moment the output file is not a TTY. For example, run the following commands and compare the output: ls ~ ls ~ | cat grep --color=auto ${hostname} /etc/hosts grep --color=auto ${hostname} /etc/hosts | cat You might be surprised at just how different and predictable the terminal utilities behave when they detect they’re being piped.
- alanbernstein 8y agols doesn't show the majority of files in my home directory "unless I ask specifically", because of an accident of history that makes files starting with a period "hidden". And yes, this would infuriate me, if I hadn't discovered shell aliases within one day of becoming a linux user. It would also infuriate me if ls took five minutes to render output, and I would also solve that with a shell alias.
- laumars 8y agoYou can’t really argue that ls not showing hidden files by default is a quirk. Next you’ll be complaining that rm doesn’t delete root owned files when run as a regular user so you created an alias to sudo rm for every operation. I’ll grant you that hidden files being defined by a prefix on the file name is a weird quirk - but at least that’s something which is consistent across all of Linux and UNIX (including OS X) and something that all tools for those respective platforms behave the same around. And to be fair, it’s a massively old convention that made sense back before metadata was a thing so it’s not even without some rationale. Ultimately though, the issue here is you don’t want any files hidden by default. Which is the opposite of the point of a hidden file. So you’d have the same complaint if the “hidden flag” was file system metadata (eg on NTFS) as you would want if it were a file name prefix.
- alanbernstein 8y agoYou're focusing on the wrong point in my comment. See the other replies by pyg in this thread. ls is not a good example of consistency to contrast with here.
- laumars 8y agopyg doesn’t say anything you hadn’t and he had the replies saying the same comments that I made. So I’m not really sure what you’re trying to argue about ls being inconsistent aside it hiding files that are widely recognised as hidden by other tools systemwide anyway. Perhaps the GUI file managers are also inconsistent because they hide hidden files by default too?
- noja 8y agoYou are right. I think the behavior should be: toolName /somepath # process all files the tool chooses to toolName /sompath/* # process every single file, even files it does not support (with a warning) This is far closer to standard behavior.
- chatmasta 8y agoIn the second case, toolName would not be aware of the '*' unless it was single-quoted. Bash would expand it to match every file, and the toolName binary would see $argN as each filename.