![]() hugo list all | from csv | last 5 | select title publishDate | to md title Remember Hugo? This was supposed to be a post about Hugo. Let’s see if we can apply some of what we just used with our Hugo article list. Syntax highlighted examples? yes please Applying what we’ve got to the Hugo list One more screenshot, because Nushell help is just so pretty. Most shells offer this in one form or another, though they don’t generally provide the command discovery path we just walked down. We can ask for help with a specific command. Then many subcommands for converting from assorted formats to a table, and their counterparts for converting from a table to assorted formats. The “formats” category includes two primary commands, from and to. Note the pattern of commands and subcommands. All that and we’re still in the realm of Nushell builtin commands. Parse binary Excel(.xlsx) data and create table. The default minimum number of spaces counted as a separator is 2. Parse text as space-separated values and create a table. Parse OpenDocument Spreadsheet(.ods) data and create table. Parse a string or binary data into structured data help commands | where category =~ formats | select name usage | to md name How about we select the name and usage? And heck - tables make for great screenshots, but let’s try see what to md gives us. ![]() I can only suggest you follow their suggestion to read the Rust regex crate documentation and figure out the differences yourself. I haven’t gone past literal substring matches yet, and the Nushell regex documentation page is basically a placeholder. Yes it’s a regular expression! But it’s almost definitely not a Perl regular expression. I bet the #perl devs perked up seeing that =~. help commands | where category =~ formats We use where to narrow the command list down so it only contains the format commands. I read ahead, so I know that from csv is under the “formats” category. Not sorted or anything, but you get the idea Listing only commands in a specific category with where To see what categories, we can group the help table. Listing command categories by groupingĪll these commands are organized into categories. That gives me a chance to show off some of the table processing I got so excited about. How many? Let’s ask the shell by piping help commands to the length command. Or see what’s available to you in your current version with help commands. You can see for yourself skimming through the Command Reference. Nushell feature two: the built-in commands and interactive help It can turn that output into something useful without any extra help thanks to an abundance of built-in commands. The table you see is a visual representation of a table in memory, which can be further processed however you need.Īlso? Nushell doesn’t need me to install an extra CSV processing tool. You can pipe from hugo to any number of CSV processing tools and pretty printers available to install on your machine.īut Nushell tables aren’t just pretty printing. Course, a pretty table is not so unusual these days. There’s the table output that I find so appealing. ![]() Of course, the result of that pipe is something a little different from other shells. Most shells let you pipe between processes, using the output of one as the input of the next. Nushell feature zero point five: Piping output hugo list all prints out a CSV summary of your site, ready for processing by some other program. I’m on Hugo again, which means I have the Hugo CLI. ![]() I have not come across a command shell that fails that test yet, but I use it as an immediate reassurance that I haven’t confused myself by launching ipython again. If you can’t easily run a program and see its output, you are in a REPL, not a shell. Nushell feature zero: showing program output Check the Nushell book’s Coming from Bash page if you want a more explicit comparison. But I use maybe 20% of a shell’s features for 80% of my needs, and a Web search for the rest. This post, and any that may follow on the topic, won’t be any kind of deep dive or contrast with other shells. I want to try again, and think through the process a little more this time. I made a throwaway one-liner when setting up Nushell on Windows. Today I use Nushell for one of my favorite learning tasks: examining my site. Got a comment? A question? More of a comment than a question?īeen using the Nushell cross-platform user shell more and more over the last couple years. Histogram for post frequency by year using Nushell built-ins Posted ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |