Skip to content

Commit

Permalink
Port before_v0.60/math, before_v0.60/parsing and `before_v0.60/gi…
Browse files Browse the repository at this point in the history
…t` (#844)

This PR is part of porting all old scripts #221 and includes a set of
small modules:
- `math`
- `parsing`
- `git`
  • Loading branch information
39555 committed May 25, 2024
1 parent 429126f commit 15cb717
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 46 deletions.
4 changes: 0 additions & 4 deletions before_v0.60/git/git_branch_cleanup.nu

This file was deleted.

33 changes: 0 additions & 33 deletions before_v0.60/maths/math_functions.nu

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Creates a table listing the branches of a git repository and the day of the last commit
def "git age" [] {
export def "git age" [] {
git branch |
lines |
str substring 2, |
str substring 2.. |
wrap name |
insert last_commit {
get name |
each {
git show $it --no-patch --format=%as | str to-datetime
git show $in --no-patch --format=%as | into datetime
}
} |
sort-by last_commit
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ def look_for [word] {
insert comp {
get shoes_name |
split row " " |
each --numbered {
[[idx, loc]; [$it.index, ($it.item | str index-of $word)]]
}
enumerate | each {
[[idx, loc]; [$in.index, ($in.item | str index-of $word)]]
} | flatten
} |
flatten |
where comp.loc >= 0 |
flatten |
update idx { $it.idx + 1 } |
update idx { $in + 1 } |
reject name price loc |
rename nameWords targetWordIndex
}

look_for "leather" | to json --pretty 4
look_for "low-top" | to json --pretty 4
print (look_for "leather" | to json --indent 4)
print (look_for "low-top" | to json --indent 4)

0 comments on commit 15cb717

Please sign in to comment.