From e4d721e08b182f43454c3a3266529461c50ad8af Mon Sep 17 00:00:00 2001 From: Jonas <99104369+phoenixr-codes@users.noreply.github.com> Date: Fri, 9 Aug 2024 15:05:41 +0200 Subject: [PATCH] Top commands one-liner (#926) This pull request adds a script containing a one-liner that can be used to get a table containing the top 5 used commands by using the history file --- sourced/cool-oneliners/top_commands.nu | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 sourced/cool-oneliners/top_commands.nu diff --git a/sourced/cool-oneliners/top_commands.nu b/sourced/cool-oneliners/top_commands.nu new file mode 100644 index 000000000..b060d44df --- /dev/null +++ b/sourced/cool-oneliners/top_commands.nu @@ -0,0 +1,2 @@ +# Evaluates the top 5 most used commands present in `nushell/history.txt`. +if $nu.history-enabled { open $nu.history-path | lines | uniq --count | sort-by --reverse count | first 5 | rename command amount } else { print --stderr "History is disabled!" }