-
Notifications
You must be signed in to change notification settings - Fork 243
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Port
before_v0.60/stdlib_candidate
(#850)
This PR is part of porting all old scripts #221 and includes the `stdlib_candidate` scripts ## 7 changed files - `flatter.nu` - `get-column.nu` - `get-row.nu` - `get-latest-release-linux.nu` - `logging.nu` - `nu_style.nu` - `print.nu`
- Loading branch information
Showing
7 changed files
with
54 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 6 additions & 9 deletions
15
before_v0.60/stdlib_candidate/get-column.nu → stdlib-candidate/std-rfc/get-column.nu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,23 @@ | ||
# Documentation for get-col | ||
# Written on 2021-03-28 06:58:50 by andras_io on discord | ||
# Written for the new Nushell version on 03/31/2022 10:10 PM by denkspuren on discord | ||
def get-col [ | ||
col_index:int # A 0 indexed col_index | ||
] { | ||
|
||
# meant to be used like `ls | get-col 1` | ||
# ls | select (ls | get | nth 2) | ||
|
||
each { | ||
echo $it | select (echo $it | get | nth $col_index) | ||
} | ||
let input = $in | ||
let name = ($input | columns | select $col_index | get 0) | ||
$input | select $name | ||
} | ||
|
||
# Documentation for get-col2 | ||
# Written on 2021-03-28 07:00:24 by johng on discord | ||
# Written for the new Nushell version on 03/31/2022 10:10 PM by denkspuren on discord | ||
def get-column [ | ||
col_index:int # A 0 indexed col_index | ||
] { | ||
|
||
# meant to be used like `ls | get-column 1` | ||
pivot | nth $col_index | pivot | get Column1 | skip | ||
$in | transpose | select $col_index | transpose | select column1 | headers | ||
} | ||
|
||
# another working example is | ||
# ls | keep 2 | drop column 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
before_v0.60/stdlib_candidate/logging.nu → stdlib-candidate/std-rfc/logging.nu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# This is a first attempt and some type of logging | ||
def log [message:any] { | ||
let now = (date now | date format '%Y%m%d_%H%M%S.%f') | ||
let now = (date now | format date '%Y%m%d_%H%M%S.%f') | ||
let mess = $"($now)|DBG|($message)(char nl)" | ||
echo $mess | autoview | ||
} | ||
$mess | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters