From fe3adb9d0be5f0b4d31ee0295318aa3f29c815e7 Mon Sep 17 00:00:00 2001 From: Aurelien Gateau Date: Tue, 18 May 2021 20:42:54 +0200 Subject: [PATCH 1/5] Add a script to list git branches and their age Useful to find forgotten stale branches. --- git/git_branch_age.nu | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100755 git/git_branch_age.nu diff --git a/git/git_branch_age.nu b/git/git_branch_age.nu new file mode 100755 index 0000000..43dd136 --- /dev/null +++ b/git/git_branch_age.nu @@ -0,0 +1,6 @@ +# Creates a table listing the branches of a git repository and the day of the last commit +git branch | lines | str substring 2, | wrap name | insert "last commit" { + get name | each { + git show $it --no-patch --format=%as + } +} | sort-by "last commit" From 274b9ff879b4634fcecce54eba5994eb90d70e5e Mon Sep 17 00:00:00 2001 From: Eli Flanagan Date: Wed, 19 May 2021 10:29:11 -0400 Subject: [PATCH 2/5] gentle git gone script This is a non-forcible branch clean up script. It is also an alternative to git_branchcleanup.nu My first inclination was to put this in cool_oneliners because it is one. But then I saw we have a few git scripts so wanted to follow them. It raises the general question: should one liners be their own category or can we derive an index of one liners, searched and sorted by topic? --- git/git_gone.nu | 3 +++ 1 file changed, 3 insertions(+) create mode 100755 git/git_gone.nu diff --git a/git/git_gone.nu b/git/git_gone.nu new file mode 100755 index 0000000..d416151 --- /dev/null +++ b/git/git_gone.nu @@ -0,0 +1,3 @@ +# gently try to delete merged branches, excluding the checked out one +# This is an alternative to git_branchcleanup.nu +git branch --merged | lines | where $it !~ '*' | str trim | where $it != 'master' && $it != 'main' | each { git branch -d $it } From d9c2483ae2a1420f0b32e73fdbda6cbbad7ae000 Mon Sep 17 00:00:00 2001 From: Eli Flanagan Date: Wed, 19 May 2021 10:32:21 -0400 Subject: [PATCH 3/5] rename git script for consistency We seem to follow `category_subcategory_action.nu` for git scripts in `git/`. To benefit future readers and possible automation, I renamed this file. --- git/{git_branchcleanup_.nu => git_branch_cleanup.nu} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename git/{git_branchcleanup_.nu => git_branch_cleanup.nu} (100%) diff --git a/git/git_branchcleanup_.nu b/git/git_branch_cleanup.nu similarity index 100% rename from git/git_branchcleanup_.nu rename to git/git_branch_cleanup.nu From 68e33fd1bf644583b749eaa8e7413236a7eba3f5 Mon Sep 17 00:00:00 2001 From: JT Date: Tue, 25 May 2021 06:37:07 +1200 Subject: [PATCH 4/5] Update make_readme_table.nu --- make_readme_table.nu | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/make_readme_table.nu b/make_readme_table.nu index 268684c..a4a2abe 100644 --- a/make_readme_table.nu +++ b/make_readme_table.nu @@ -7,27 +7,24 @@ # Right now there is still manual manipulation in order to update the README.md # Hopefully, in the future someone will contribute a script to make this automatic. -let nu_files = $(ls **/*.nu) -let nu_table = $(echo $nu_files | +let nu_files = (ls **/*.nu) +let nu_table = ($nu_files | get name | wrap File | - insert 'Nu Version' 0.26 | + insert 'Nu Version' 0.32 | insert Description desc | - insert Category { - let cat = $(get File | path dirname) + insert Category { |it| + let cat = ($it.File | path dirname) if $cat == "" { - echo "not assigned yet" + "not assigned yet" } { - echo $cat + $cat } } | select Category File 'Nu Version' Description) - # Let's fix the file now -let nu_table = $(echo $nu_table | update File { - let file_path = $(get File) - let file_name = $(echo $file_path | path basename) - let file_link = $(build-string "[" $file_name "]" "(./" $file_path ")") - echo $file_link +let nu_table = ($nu_table | update File { |it| + let file_path = $it.File + let file_name = ($file_path | path basename) + $"[($file_name)](char lparen)./($file_path)(char rparen)" }) - -echo $nu_table | to md --pretty \ No newline at end of file +$nu_table | to md --pretty From fc4822c1b198791cd95e3202a2040ad0c8e54d82 Mon Sep 17 00:00:00 2001 From: JT Date: Tue, 25 May 2021 07:04:07 +1200 Subject: [PATCH 5/5] Update make_readme_table.nu --- make_readme_table.nu | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/make_readme_table.nu b/make_readme_table.nu index a4a2abe..e29eac0 100644 --- a/make_readme_table.nu +++ b/make_readme_table.nu @@ -1,8 +1,8 @@ # A Script to try and create the table for the readme.md file # | Category | File | Nu Version | Description | # | ---------------- | --------------------------------------------------------- | ---------- | ----------- | -# | coloring | [color_table.nu](./coloring/color_table.nu) | 0.26 | desc | -# | coloring | [color_tables.nu](./coloring/color_tables.nu) | 0.26 | desc | +# | coloring | [color_table.nu](./coloring/color_table.nu) | 0.32 | desc | +# | coloring | [color_tables.nu](./coloring/color_tables.nu) | 0.32 | desc | # Right now there is still manual manipulation in order to update the README.md # Hopefully, in the future someone will contribute a script to make this automatic.