The Fluidinfo Shell, Fish
(documented here)
has a gained a few important new features. In summary, these are
Happy fishing!
Interactive Shell. If invoked without any parameters,Fish will start an interactive session that allows you to issue a sequences of Fish commands (without prefixing them by fish).Points to note include:$ fish This is fish version 3.12. > whoami alice > ls books/ favourite-things private/ test-fish/ comment has-read rating to-read > show -a 'book:animal farm (george orwell)' alice/rating Object with about="book:animal farm (george orwell)": alice/rating = 2 > show -a "`about book 'animal farm' 'george orwell'`" alice/rating Object with about="book:animal farm (george orwell)": alice/rating = 2 > ^D $
- If the readline library is available to python, it will be used, allowing Emacs key bindings to be used to edit the command line (as well as arrow keys) and saving a command history, which may be navigated with CTRL-P and CTRL-N or up and down arrows. You can also view the history by typing history or h.
The interactive session is exited by typing the end-of-filecharacter—CTRL-D on Unix and CTRL-Z on Windows. Command substitution with left quoting (“backticks”) is supportedas illustraed in the last example of the interactive session shown (explanation below). Single and double quotes may be used interchangeably, andare protected by each other. Quotes and other special characters may be escaped using backslash, which also escapes itself. So, for example, Alice's Adventures in Wonderland may be passed as a parameter withor"Alice's Adventures in Wonderland"
'Alice\'s Adventures in Wonderland' Obviously, on Unix, when using the interactive shell, theUnix shell does not process the command line, meaning, among other things, that there is no globbing (wildcard expansion). Command Substitution. Unix users will be familiar withcommand substitution, which now comes to Fish. The way this works in Unix shells is that any part of a command enclosed in left quotes (“backticks”) is evaluated before the enclosing command, and its output replaces it in that enclosing command. This is particularly relevant to the commands that build Fluidinfo about tags—abouttag, amazon and the new normalize command (see below). In Unix shells, it has always been possible to say:The shell first evaluates the subcommand, which produces the output book:animal farm (george orwell) and then, after substitution, the shell executes:$ fish show -a "`fish abouttag book 'animal farm' 'george orwell'`" alice/ratingIn Unix, double quotes are weaker than single quotes, and command substitution can still occur inside them, which is exactly what we need in this case. Fish now makes almost identical functionality available in its new interactive mode. In the interactive shell you can say$ fish show -a "book:animal farm (george orwell)" alice/ratingThis command is identical except that the leading fish is no longer needed within the substitution command (though it can be used), just as it not needed in the outer show command.> show -a "`about book 'animal farm' 'george orwell'`" alice/rating Command substitution in Shell-Fish. The online version ofFish, Shell-Fish also benefits from the new command substution capabilities, but does not yet include the history feature. Whether readline-like command line editing is available is a feature of the browser (today). The new normalize command. A new normalize command hasbeen added to Fish. This simply performs some standardization on text, consisting primarily of mapping to lower case, removing most punctuation and standardizing whitespace; accents are preserved. If multiple arguments are passed, the components are joined with colons. For example:$ fish normalize 'A *very* strange (and wonderful) fish' a very strange and wonderful fish $ fish normalize golfer 'Darren Clarke' golfer:darren clarke
No comments:
Post a Comment