\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{lomm28} \pdfinfo{ /Title (nushell.pdf) /Creator (Cheatography) /Author (lomm28) /Subject (Nushell Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{A3A3A3} \definecolor{LightBackground}{HTML}{F3F3F3} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{Nushell Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{lomm28} via \textcolor{DarkBackground}{\uline{cheatography.com/191865/cs/39872/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}lomm28 \\ \uline{cheatography.com/lomm28} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Not Yet Published.\\ Updated 22nd August, 2023.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{tabularx}{17.67cm}{x{8.635 cm} x{8.635 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Data Types}} \tn % Row 0 \SetRowColor{LightBackground} \{\{width=50\}\}`\{\{lang-shell\}\} \textgreater{} "-5" | into int` & \{\{width=50\}\}{\bf{converts string to integer}} \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} `\{\{lang-shell\}\} \textgreater{} date now | date to-timezone "Europe/London"` & {\bf{converts present date to provided time zone}} \tn % Row Count 7 (+ 4) % Row 2 \SetRowColor{LightBackground} `\{\{lang-shell\}\} \textgreater{} \{'name': 'nu', 'stars': 5, 'language': 'Python'\} \{\{nl\}\} | upsert language 'Rust'` & {\bf{updates a record's language and if none is specified inserts provided value}} \tn % Row Count 13 (+ 6) % Row 3 \SetRowColor{white} `\{\{lang-shell\}\} \textgreater{} {[}one two three{]} | to yaml` & {\bf{converts list of strings to yaml}} \tn % Row Count 16 (+ 3) % Row 4 \SetRowColor{LightBackground} `\{\{lang-shell\}\} \textgreater{} {[}\{name: 'Robert' age: 34 position: 'Designer'\} \{\{nl\}\} \{name: 'Margaret' age: 30 position: 'Software Developer'\} \{\{nl\}\} \{name: 'Natalie' age: 50 position: 'Accountant'\}{]} \{\{nl\}\} | select name position` & {\bf{selects two columns from the table and prints their values}} \tn % Row Count 27 (+ 11) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{8.635 cm} x{8.635 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Lists}} \tn % Row 0 \SetRowColor{LightBackground} \{\{width=50\}\}`\{\{lang-shell\}\} \textgreater{} {[}foo bar baz{]} | insert 1 'beeze' \{\{nl\}\} \textgreater{} \$string\_list` & \{\{width=50\}\}{\bf{inserts `beeze` value at st index in the list}} \tn % Row Count 5 (+ 5) % Row 1 \SetRowColor{white} `\{\{lang-shell\}\} \textgreater{} {[}1, 2, 3, 4{]} | update 1 10` & {\bf{updates 2nd value to 10}} \tn % Row Count 8 (+ 3) % Row 2 \SetRowColor{LightBackground} `\{\{lang-shell\}\} \textgreater{} let numbers = {[}1, 2, 3, 4, 5{]} \{\{nl\}\} \textgreater{} \$numbers | prepend 0` & {\bf{adds value at the beginning of the list}} \tn % Row Count 12 (+ 4) % Row 3 \SetRowColor{white} `\{\{lang-shell\}\} \textgreater{} let numbers = {[}1, 2, 3, 4, 5{]} \{\{nl\}\} \textgreater{} \$numbers | append 6` \{\{nl\}\} & {\bf{adds value at the end of the list}} \tn % Row Count 17 (+ 5) % Row 4 \SetRowColor{LightBackground} `\{\{lang-shell\}\} \textgreater{} let flowers = {[}cammomile marigold rose forget-me-not{]} \{\{nl\}\} \textgreater{} let flowers = (\$flowers | first 2) \{\{nl\}\} \textgreater{} \$flowers` & {\bf{creates slice of the first two values from `flowers` list}} \tn % Row Count 24 (+ 7) % Row 5 \SetRowColor{white} `\{\{lang-shell\}\} \textgreater{} let planets = {[}Mars Jupiter Saturn Uranus Neptune{]} \{\{nl\}\} \textgreater{} \$planets | each \{ |it| \$"(\$it) is a planet of solar system" \}` & {\bf{iterates over a list; `it` is current list value}} \tn % Row Count 31 (+ 7) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{8.635 cm} x{8.635 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Lists (cont)}} \tn % Row 6 \SetRowColor{LightBackground} `\{\{lang-shell\}\} \textgreater{} \$planets | enumerate | each \{ \{\{nl\}\} |it| \$"(\$it.index + 1) - (\$it.item)" \{\{nl\}\} \}` & {\bf{iterates over a list and provides index and value in `it`}} \tn % Row Count 6 (+ 6) % Row 7 \SetRowColor{white} `\{\{lang-shell\}\} \textgreater{} let scores = {[}3 8 4{]} \{\{nl\}\} \textgreater{} \$"total = (\$scores | reduce \{ |it, acc| \$acc + \$it \})"` & {\bf{reduces the list to a single value, `reduce` gives access to accumulator that is applied to each element in the list}} \tn % Row Count 12 (+ 6) % Row 8 \SetRowColor{LightBackground} `\{\{lang-shell\}\} \textgreater{} \$"total = (\$scores | reduce -{}-fold 1 \{ |it, acc| \$acc * \$it \})"` & {\bf{initial value for accamulator value can be set with `-{}-fold`}} \tn % Row Count 17 (+ 5) % Row 9 \SetRowColor{white} `\{\{lang-shell\}\} \textgreater{} let planets = {[}Mars Jupiter Saturn Uranus Neptune{]} \{\{nl\}\} \textgreater{} \$planets.2` & {\bf{gives access to the 3rd item in the list}} \tn % Row Count 22 (+ 5) % Row 10 \SetRowColor{LightBackground} `\{\{lang-shell\}\} \textgreater{} let planets = {[}Mars Jupiter Saturn Uranus Neptune{]} \{\{nl\}\} \textgreater{} \$planets | any \{|it| \$it | str starts-with "E" \}` & {\bf{checks if any string in the list starts with `E`}} \tn % Row Count 29 (+ 7) % Row 11 \SetRowColor{white} `\{\{lang-shell\}\} \textgreater{} let cond = \{|x| \$x \textless{} 0 \}; {[}-1 -2 9 1{]} | take while \$cond` & {\bf{creates slice of items that satisfy provided condition}} \tn % Row Count 33 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{8.635 cm} x{8.635 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Tables}} \tn % Row 0 \SetRowColor{LightBackground} \{\{width=50\}\}`\{\{lang-shell\}\} \textgreater{} ls | sort-by size` & \{\{width=50\}\}{\bf{sorting table by size of files}} \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} `\{\{lang-shell\}\} \textgreater{} ls | sort-by size | first 5` & {\bf{sorting table by size of files and show first 5 entries}} \tn % Row Count 6 (+ 3) % Row 2 \SetRowColor{LightBackground} `\{\{lang-shell\}\} \textgreater{} let \$a = {[}\{\{nl\}\} {[}a\_col b\_col c\_col{]}; {[}foo bar snooze{]}\{\{nl\}\} {]} \{\{nl\}\} \textgreater{} let \$b = {[}\{\{nl\}\} {[}a\_col b\_col c\_col{]}; {[}hex seeze feeze{]}\{\{nl\}\} {]} \{\{nl\}\} \textgreater{} \$a | append \$b` & {\bf{concatenates two tables with same columns}} \tn % Row Count 16 (+ 10) % Row 3 \SetRowColor{white} `\{\{lang-shell\}\} \textgreater{} let teams\_scores = {[}\{\{nl\}\} {[}team score plays{]}; {[}'team\_1' 311 3{]} {[}'team\_2', 245 2{]}\{\{nl\}\} {]} \{\{nl\}\} \textgreater{} \$teams\_scores | drop column` & {\bf{removes the last column of a table}} \tn % Row Count 24 (+ 8) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{8.635 cm} x{8.635 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Files \& Filesystem}} \tn % Row 0 \SetRowColor{LightBackground} \{\{width=50\}\}`\{\{lang-shell\}\} \textgreater{} start file.txt` & \{\{width=50\}\}{\bf{opens a text file with the default text editor}} \tn % Row Count 4 (+ 4) % Row 1 \SetRowColor{white} `\{\{lang-shell\}\} \textgreater{} 'lorem ipsum ' | save file.txt` & {\bf{saves a string to text file}} \tn % Row Count 7 (+ 3) % Row 2 \SetRowColor{LightBackground} `\{\{lang-shell\}\} \textgreater{} 'dolor sit amet' | save -{}-append file.txt` & {\bf{appends a string to the end of file.txt}} \tn % Row Count 10 (+ 3) % Row 3 \SetRowColor{white} `\{\{lang-shell\}\} \textgreater{} \{ a: 1, b: 2 \} | save file.json` & {\bf{saves a record to file.json}} \tn % Row Count 13 (+ 3) % Row 4 \SetRowColor{LightBackground} `\{\{lang-shell\}\} \textgreater{} glob **/*.\{rs,toml\} -{}-depth 2` & {\bf{searches for `.rs` and `.toml` files recursively up to 2 folders deep}} \tn % Row Count 17 (+ 4) % Row 5 \SetRowColor{white} `\{\{lang-shell\}\} \textgreater{} watch . -{}-glob=**/*.rs \{|| cargo test \}` & {\bf{runs cargo test whenever a Rust file changes}} \tn % Row Count 20 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{8.635 cm} x{8.635 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Custom Commands}} \tn % Row 0 \SetRowColor{LightBackground} \{\{width=50\}\}`\{\{lang-shell\}\} def greet {[}name: string{]} \{ \{\{nl\}\} \$"hello (\$name)" \{\{nl\}\} \}` & \{\{width=50\}\}{\bf{custom command with parameter type set to `string`}} \tn % Row Count 5 (+ 5) % Row 1 \SetRowColor{white} `\{\{lang-shell\}\} def greet {[}name = "nushell"{]} \{ \{\{nl\}\} \$"hello (\$name)" \{\{nl\}\} \}` & {\bf{custom command with default parameter set to `nushell`}} \tn % Row Count 10 (+ 5) % Row 2 \SetRowColor{LightBackground} `\{\{lang-shell\}\} def greet {[} \{\{nl\}\} name: string \{\{nl\}\} -{}-age: int \{\{nl\}\} {]} \{ \{\{nl\}\} {[}\$name \$age{]} \{\{nl\}\} \} \{\{nl\}\} \textgreater{} greet world -{}-age 10` & {\bf{passing named parameter by defining flag for custom commands}} \tn % Row Count 18 (+ 8) % Row 3 \SetRowColor{white} `\{\{lang-shell\}\} def greet {[} \{\{nl\}\} name: string \{\{nl\}\} -{}-age (-a): int \{\{nl\}\} -{}-twice \{\{nl\}\} {]} \{ \{\{nl\}\} if \$twice \{ \{\{nl\}\} {[}\$name \$age \$name \$age{]} \{\{nl\}\} \} else \{ \{\{nl\}\} {[}\$name \$age{]}\{\{nl\}\} \} \{\{nl\}\} \} \{\{nl\}\}\textgreater{} greet -a 10 -{}-twice hello` & {\bf{using flag as a switch with a shorthand flag (`-a`) for the age}} \tn % Row Count 32 (+ 14) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{8.635 cm} x{8.635 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Custom Commands (cont)}} \tn % Row 4 \SetRowColor{LightBackground} `\{\{lang-shell\}\} def greet {[}...name: string{]} \{ \{\{nl\}\} print "hello all:" \{\{nl\}\} for \$n in \$name \{ \{\{nl\}\} print \$n \{\{nl\}\} \} \{\{nl\}\} \} \{\{nl\}\} \textgreater{} greet earth mars jupiter venus` & {\bf{custom command which takes any number of positional arguments using rest params}} \tn % Row Count 10 (+ 10) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{8.635 cm} x{8.635 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Variables and Subexpressions}} \tn % Row 0 \SetRowColor{LightBackground} \{\{width=50\}\}`\{\{lang-shell\}\} \textgreater{} let val = 42 \{\{nl\}\} \textgreater{} print \$val \{\{nl\}\} 42` & \{\{width=50\}\}{\bf{an immutable variable cannot change its value after declaration}} \tn % Row Count 4 (+ 4) % Row 1 \SetRowColor{white} `\{\{lang-shell\}\} \textgreater{} let val = 42 \{\{nl\}\} \textgreater{} do \{ let val = 101; \$val \} \{\{nl\}\} 101 \{\{nl\}\} \textgreater{} \$val \{\{nl\}\} 42` & {\bf{shadowing variable (declaring variable with the same name in a different scope)}} \tn % Row Count 10 (+ 6) % Row 2 \SetRowColor{LightBackground} `\{\{lang-shell\}\} \textgreater{} mut val = 42 \{\{nl\}\} \textgreater{} \$val += 27 \{\{nl\}\} \textgreater{} \$val \{\{nl\}\} 69` & {\bf{declaring a mutable variable with `mut` key word}} \tn % Row Count 14 (+ 4) % Row 3 \SetRowColor{white} `\{\{lang-shell\}\} \textgreater{} mut x = 0 \{\{nl\}\} \textgreater{} {[}1 2 3{]} | each \{ \$x += 1 \}` & {\bf{closures and nested defs cannot capture mutable variables from their environment. This expression results in error.}} \tn % Row Count 20 (+ 6) % Row 4 \SetRowColor{LightBackground} `\{\{lang-shell\}\} \textgreater{} const plugin = 'path/to/plugin' \{\{nl\}\} \textgreater{} register \$plugin` & {\bf{a constant variable is immutable value which is fully evaluated at parse-time}} \tn % Row Count 25 (+ 5) % Row 5 \SetRowColor{white} `\{\{lang-shell\}\} \textgreater{} let files = (ls) \{\{nl\}\} \textgreater{} \$files.name?.0?` & {\bf{using question mark operator to return `null` instead of error if provided path is incorrect}} \tn % Row Count 30 (+ 5) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{8.635 cm} x{8.635 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Variables and Subexpressions (cont)}} \tn % Row 6 \SetRowColor{LightBackground} `\{\{lang-shell\}\} \textgreater{} let big\_files = (ls | where size \textgreater{} 10kb) \{\{nl\}\} \textgreater{} \$big\_files` & {\bf{using subexpression by wrapping the expression with parentheses `()`}} \tn % Row Count 4 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{8.635 cm} x{8.635 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Modules}} \tn % Row 0 \SetRowColor{LightBackground} \{\{width=50\}\}`\{\{lang-shell\}\} \textgreater{} module greetings \{ \{\{nl\}\} export def hello {[}name: string{]} \{ \{\{nl\}\} \$"hello (\$name)!" \{\{nl\}\} \} \{\{nl\}\} export def hi {[}where: string{]} \{ \{\{nl\}\} \$"hi (\$where)!" \{\{nl\}\} \} \{\{nl\}\} \} \{\{nl\}\} \textgreater{} use greetings hello \{\{nl\}\} \textgreater{} hello "world"` & \{\{width=50\}\}{\bf{using inline module}} \tn % Row Count 15 (+ 15) % Row 1 \SetRowColor{white} `\{\{lang-shell\}\} \# greetings.nu \{\{nl\}\} export-env \{ \{\{nl\}\} \$env.MYNAME = "Arthur, King of the Britons" \{\{nl\}\} \} \{\{nl\}\} export def hello {[}{]} \{ \{\{nl\}\} \$"hello (\$env.MYNAME)" \{\{nl\}\} \} \{\{nl\}\} \textgreater{} use greetings.nu \{\{nl\}\} \textgreater{} \$env.MYNAME \{\{nl\}\} Arthur, King of the Britons \{\{nl\}\} \textgreater{} greetings hello \{\{nl\}\} hello Arthur, King of the Britons!` & {\bf{importing module from file and using its environment in current scope}} \tn % Row Count 32 (+ 17) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{8.635 cm} x{8.635 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Modules (cont)}} \tn % Row 2 \SetRowColor{LightBackground} `\{\{lang-shell\}\} \# greetings.nu \{\{nl\}\} export def hello {[}name: string{]} \{ \{\{nl\}\} \$"hello (\$name)!" \{\{nl\}\} \} \{\{nl\}\} export def hi {[}where: string{]} \{ \{\{nl\}\} \$"hi (\$where)!" \{\{nl\}\} \} \{\{nl\}\} export def main {[}{]} \{ \{\{nl\}\} "greetings and salutations!"\{\{nl\}\} \} \{\{nl\}\} \textgreater{} use greetings.nu \{\{nl\}\} \textgreater{} greetings \{\{nl\}\} greetings and salutations! \{\{nl\}\} \textgreater{} greetings hello world \{\{nl\}\} hello world!` & {\bf{using `main` command in module}} \tn % Row Count 20 (+ 20) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{8.635 cm} x{8.635 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Strings}} \tn % Row 0 \SetRowColor{LightBackground} \{\{width=50\}\}`\{\{lang-shell\}\} \textgreater{} let name = "Alice" \{\{nl\}\} \textgreater{} \$"greetings, (\$name)!"` & \{\{width=50\}\}{\bf{prints `greetings, Alice!`}} \tn % Row Count 5 (+ 5) % Row 1 \SetRowColor{white} `\{\{lang-shell\}\} \textgreater{} let string\_list = "one,two,three" | split row "," \{\{nl\}\} \textgreater{} \$string\_list` & {\bf{splits the string with specified delimiter and saves the list to `string\_list` variable}} \tn % Row Count 10 (+ 5) % Row 2 \SetRowColor{LightBackground} `\{\{lang-shell\}\} \textgreater{} "Hello, world!" | str contains "o, w" \{\{nl\}\} \textgreater{} \$string\_list` & {\bf{checks if a string contains a substring and returns `boolean`}} \tn % Row Count 14 (+ 4) % Row 3 \SetRowColor{white} `\{\{lang-shell\}\} \textgreater{} let str\_list = {[}zero one two{]} \{\{nl\}\} \textgreater{} \$str\_list str join ','` & {\bf{joins the list of strings using provided delimiter}} \tn % Row Count 18 (+ 4) % Row 4 \SetRowColor{LightBackground} `\{\{lang-shell\}\} \textgreater{} 'Hello World!' | str substring 4..8` & {\bf{created a slice from a given string with start (4) and end (8) indices}} \tn % Row Count 22 (+ 4) % Row 5 \SetRowColor{white} `\{\{lang-shell\}\} \textgreater{} 'Nushell 0.80' | parse '\{shell\} \{version\}'` & {\bf{parses a string into a table}} \tn % Row Count 26 (+ 4) % Row 6 \SetRowColor{LightBackground} `\{\{lang-shell\}\} \textgreater{} "acronym,long\textbackslash{}nAPL,A Programming Language" | from csv` & {\bf{parses comma separated values (csv)}} \tn % Row Count 30 (+ 4) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{8.635 cm} x{8.635 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Strings (cont)}} \tn % Row 7 \SetRowColor{LightBackground} `\{\{lang-shell\}\} \textgreater{} \$'(ansi purple\_bold)This text is a bold purple!(ansi reset)'` & {\bf{ansi command colors the text (alsways end with `ansi reset` to reset color to default)}} \tn % Row Count 5 (+ 5) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \end{document}