diff --git a/docs/commands/from-tsv.md b/docs/commands/from-tsv.md new file mode 100644 index 0000000000..86452de97a --- /dev/null +++ b/docs/commands/from-tsv.md @@ -0,0 +1,52 @@ +# from-tsv + +Parse text as `.tsv` and create table. + +Syntax: `from-tsv {flags}` + +### Flags: + + --headerless + don't treat the first row as column names + +## Examples + +Let's say we have the following file which is formatted like a `tsv` file: + +```shell +> open elements.txt +Symbol Element +H Hydrogen +He Helium +Li Lithium +Be Beryllium +``` + +If we pass the output of the `open` command to `from-tsv` we get a correct formatted table: + +```shell +> open elements.txt | from-tsv +━━━┯━━━━━━━━┯━━━━━━━━━━━ + # │ Symbol │ Element +───┼────────┼─────────── + 0 │ H │ Hydrogen + 1 │ He │ Helium + 2 │ Li │ Lithium + 3 │ Be │ Beryllium +━━━┷━━━━━━━━┷━━━━━━━━━━━ +``` + +Using the `--headerless` flag has the following output: + +```shell +> open elements.txt | from-tsv --headerless +━━━━┯━━━━━━━━━┯━━━━━━━━━━━ + # │ Column1 │ Column2 +────┼─────────┼─────────── + 0 │ Symbol │ Element + 1 │ H │ Hydrogen + 2 │ He │ Helium + 3 │ Li │ Lithium + 4 │ Be │ Beryllium +━━━━┷━━━━━━━━━┷━━━━━━━━━━━ +``` \ No newline at end of file diff --git a/docs/commands/from-xml.md b/docs/commands/from-xml.md new file mode 100644 index 0000000000..d7a9e2a78d --- /dev/null +++ b/docs/commands/from-xml.md @@ -0,0 +1,34 @@ +# from-xml + +Parse text as `.xml` and create table. Use this when nushell cannot dertermine the input file extension. + +Syntax: `from-xml` + +## Examples + +Let's say we've got a file in `xml` format but the file extension is different so Nu can't auto-format it: + +```shell +> open world.txt + + + Africa + Antarctica + Asia + Australia + Europe + North America + South America + +``` + +We can use `from-xml` to read the input like a `xml` file: + +```shell +> open world.txt | from-xml +━━━━━━━━━━━━━━━━ + world +──────────────── + [table 7 rows] +━━━━━━━━━━━━━━━━ +``` \ No newline at end of file