In normal bash-land, I use 'more' as a command to output the content of a file with breaking up the content by default at the end of the visible terminal space.
$ more index.cfm
Obviously it can also be used to pipe content into via
$ something index.cfm | more
In a CommandBox shell, I have to use 'cat' for displaying a file's content and it's just a small, confusing but slightly annoying thing.
Is there a way to make 'more' both a command as well as a pipe destination? 'more' as a command could probably just be an alias to 'cat <file> | more' - if that's technically possible and if I make any sense
Ah, cool - I assume that’s one of the files that if I change it and reload the shell, the changes will be picked up without a full build?
Right, grabbed the ticket and I’ll give that actually a try!
Great. Just reading through the comments here, a couple thoughts came to mind:
a second parameter “file” would work well enough if it was the default parameter when tabbing instead of “input=”
I don’t think we want to do that. If we make the “file” parameter the first param and move the “input” param back to the second location, that will mean you can’t pipe arbitrary input in any longer as it will land in the first param. So this would no longer work
The only way a “file” param works is as a second parameter. That said, I’m ok with the option to check and see if the input is a file with a fileExists() check. Just run it through the resolvePath() function to handle relative paths, and then use fileExists().
The only possible issue I can image is if the contents of the input variable contained some special chars that caused an exception to be thrown from the fileExists() check, but that may not be an issue. Or at least, not an issue we can’t try/catch if it exists.