Skip to content

Commit 15cb717

Browse files
authored
Port before_v0.60/math, before_v0.60/parsing and before_v0.60/git (#844)
This PR is part of porting all old scripts #221 and includes a set of small modules: - `math` - `parsing` - `git`
1 parent 429126f commit 15cb717

File tree

7 files changed

+9
-46
lines changed

7 files changed

+9
-46
lines changed

before_v0.60/git/git_branch_cleanup.nu

-4
This file was deleted.

before_v0.60/maths/math_functions.nu

-33
This file was deleted.
File renamed without changes.

before_v0.60/git/git_branch_age.nu modules/git/git_branch_age.nu

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# Creates a table listing the branches of a git repository and the day of the last commit
2-
def "git age" [] {
2+
export def "git age" [] {
33
git branch |
44
lines |
5-
str substring 2, |
5+
str substring 2.. |
66
wrap name |
77
insert last_commit {
88
get name |
99
each {
10-
git show $it --no-patch --format=%as | str to-datetime
10+
git show $in --no-patch --format=%as | into datetime
1111
}
1212
} |
1313
sort-by last_commit
File renamed without changes.
File renamed without changes.

before_v0.60/parsing/sample_andres.nu modules/parsing/sample_andres.nu

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ def look_for [word] {
55
insert comp {
66
get shoes_name |
77
split row " " |
8-
each --numbered {
9-
[[idx, loc]; [$it.index, ($it.item | str index-of $word)]]
10-
}
8+
enumerate | each {
9+
[[idx, loc]; [$in.index, ($in.item | str index-of $word)]]
10+
} | flatten
1111
} |
1212
flatten |
1313
where comp.loc >= 0 |
1414
flatten |
15-
update idx { $it.idx + 1 } |
15+
update idx { $in + 1 } |
1616
reject name price loc |
1717
rename nameWords targetWordIndex
1818
}
1919

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

0 commit comments

Comments
 (0)