mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-02 07:07:46 +00:00
Merge branch 'nushell:main' into main
This commit is contained in:
commit
d9e24137dc
3 changed files with 34 additions and 5 deletions
|
@ -1,6 +1,15 @@
|
||||||
# Creates a table listing the branches of a git repository and the day of the last commit
|
# 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" {
|
def "git age" [] {
|
||||||
get name | each {
|
git branch |
|
||||||
git show $it --no-patch --format=%as
|
lines |
|
||||||
}
|
str substring 2, |
|
||||||
} | sort-by "last commit"
|
wrap name |
|
||||||
|
insert last_commit {
|
||||||
|
get name |
|
||||||
|
each {
|
||||||
|
git show $it --no-patch --format=%as | str to-datetime
|
||||||
|
}
|
||||||
|
} |
|
||||||
|
sort-by last_commit
|
||||||
|
}
|
||||||
|
|
||||||
|
|
7
with_externals/README.md
Normal file
7
with_externals/README.md
Normal file
|
@ -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.
|
13
with_externals/loc.nu
Normal file
13
with_externals/loc.nu
Normal file
|
@ -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
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue