diff --git a/git/git_branch_age.nu b/git/git_branch_age.nu index 43dd136..9e30bf6 100755 --- a/git/git_branch_age.nu +++ b/git/git_branch_age.nu @@ -1,6 +1,15 @@ # 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" +def "git age" [] { + git branch | + lines | + str substring 2, | + wrap name | + insert last_commit { + get name | + each { + git show $it --no-patch --format=%as | str to-datetime + } + } | + sort-by last_commit +} + diff --git a/with_externals/README.md b/with_externals/README.md new file mode 100644 index 0000000..32559fb --- /dev/null +++ b/with_externals/README.md @@ -0,0 +1,7 @@ +# With Externals + +This folder includes various nushell scripts that require installing an external program in order to work. + +### Contributing + +Please include the name of the program and, if possible, basic installation instructions, as part of your script. diff --git a/with_externals/loc.nu b/with_externals/loc.nu new file mode 100644 index 0000000..41524ca --- /dev/null +++ b/with_externals/loc.nu @@ -0,0 +1,13 @@ +# This script requires that `tokei` be installed and available! + +# Count lines of code in a project. +def "loc" [ + ...rest # args to pass to tokei +] { + tokei -o json $rest | + from json | + pivot | + rename lang lines | + insert files { get lines.reports | length } | + select lang files lines.code lines.comments lines.blanks +}