Home Explore Blog CI



nushell

15th chunk of `cookbook/parsing_git_log.md`
9fd31413e84083ff6b9d3032b03e41b83cd767bf0e11d67900000001000010a7
# =>    4 │ Michael Angerman                │      61
# =>    5 │ Andrés N. Robalino              │      29
# =>    6 │ Luccas Mateus                   │      27
# =>    7 │ Stefan Stanciulescu             │      27
# =>    8 │ Sophia Turner                   │      23
# =>    9 │ Tanishq Kancharla               │      21
# =>   10 │ Justin Ma                       │      21
# =>   11 │ onthebridgetonowhere            │      20
# =>   12 │ xiuxiu62                        │      19
# => ...
```

This is still a lot of data so let's just look at the top 10 and use the `rename` command to name the columns. We could've also provided the column names with the `transpose` command.

```nu
git log --pretty=%h»¦«%s»¦«%aN»¦«%aE»¦«%aD | lines | split column "»¦«" commit subject name email date | upsert date {|d| $d.date | into datetime} | group-by name | transpose | upsert column1 {|c| $c.column1 | length} | sort-by column1 | rename name commits | reverse | first 10
# => ───┬────────────────────┬─────────
# =>  # │        name        │ commits
# => ───┼────────────────────┼─────────
# =>  0 │ Sophia Turner      │    1420
# =>  1 │ Sophia             │     851
# =>  2 │ Andrés N. Robalino │     383
# =>  3 │ Darren Schroeder   │     380
# =>  4 │ Fernando Herrera   │     176
# =>  5 │ Yehuda Katz        │     165
# =>  6 │ Jakub Žádník       │     140
# =>  7 │ Joseph T. Lyons    │      87
# =>  8 │ Michael Angerman   │      71
# =>  9 │ Jason Gedge        │      67
# => ───┴────────────────────┴─────────
```

And there you have it. The top 10 committers and we learned a little bit of parsing along the way.

Here's one last little known command. Perhaps you don't want your table numbered starting with 0. Here's a way to change that with the `table` command.

```nu
git log --pretty=%h»¦«%s»¦«%aN»¦«%aE»¦«%aD | lines | split column "»¦«" commit subject name email date | upsert date {|d| $d.date | into datetime} | group-by name | transpose | upsert column1 {|c| $c.column1 | length} | sort-by column1 | rename name commits | reverse | first 10 | table -n 1
# => ────┬────────────────────┬─────────
# =>  #  │        name        │ commits
# => ────┼────────────────────┼─────────
# =>   1 │ Sophia Turner      │    1420
# =>   2 │ Sophia             │     851
# =>   3 │ Andrés N. Robalino │     383
# =>   4 │ Darren Schroeder   │     380
# =>   5 │ Fernando Herrera   │     176
# =>   6 │ Yehuda Katz        │     165
# =>   7 │ Jakub Žádník       │     140
# =>   8 │ Joseph T. Lyons    │      87
# =>   9 │ Michael Angerman   │      71
# =>  10 │ Jason Gedge        │      67
```

Created on 11/9/2020 with Nushell on Windows 10.
Updated on 3/1/2022 with Nushell on Windows 10.

| key                | value                                    |
| ------------------ | ---------------------------------------- |
| version            | 0.59.0                                   |
| branch             | main                                     |
| short_commit       | b09acdb7                                 |
| commit_hash        | b09acdb7f98ec9694cfb223222577bc02ebba4a4 |
| commit_date        | 2022-02-28 15:14:33 +00:00               |
| build_os           | windows-x86_64                           |
| rust_version       | rustc 1.59.0 (9d1b2106e 2022-02-23)      |
| rust_channel       | stable-x86_64-pc-windows-msvc            |
| cargo_version      | cargo 1.59.0 (49d8809dc 2022-02-10)      |
| pkg_version        | 0.59.0                                   |
| build_time         | 2022-02-28 16:16:00 -06:00               |
| build_rust_channel | debug                                    |
| features           | dataframe, default, trash, which, zip    |
| installed_plugins  | gstat                                    |

Title: Final Touches: Table Numbering and Nushell Environment Details
Summary
This section concludes the git log parsing example by showing how to adjust the starting number of the table using the `table -n` command. It then provides information about the Nushell environment used to create and update the example, including version number, git commit details, build information, and installed plugins. This metadata offers context about the environment in which the commands were executed.