1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-08-02 07:07:46 +00:00

Port before_v0.60/config_management before_v0.60/language before_v0.60/prompt before_v0.60/tests (#851)

This PR is part of porting all old scripts #221 and includes a set of
modules:

- `config_management`
- `language`
- `tests`
- `prompt`

## 12 files changed

### `config_management`
This module was removed, because it was related to the old `config.toml`
format
1. `README.md`: removed
2. `config.toml`: removed
3. `startup.nu`: removed

### `language`
4. `playground.nu` : unchanged because this is just `source ...`
5. `std.nu` : unchanged because this is just `source ...`
6. `playground/lib.nu` -> `playground/mod.nu` and all commands have been
exported
7. `std/date.nu` + `export` keyword

### `tests`
This module contained only the usage of `language` module, so I merged
it with `language`
8. `tests/language/std/date.nu` -> `modules/language/tests/date.nu`
9. `main.nu`: removed because it was just `source date.nu`

### `prompt`
10. `git_status_prompt.nu` -> `modules/git_status_prompt.nu` + `export`
keyword
11. `left_and_right_prompt.nu` -> `modules/left_and_right_prompt.nu` +
`export` keyword
12. `README.md` : has been removed as a duplicate of
`modules/prompt/README.md`
This commit is contained in:
Igor 2024-05-26 21:37:01 +04:00 committed by GitHub
parent e8df70a406
commit 9d399d8902
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 273 additions and 336 deletions

View file

@ -0,0 +1,54 @@
export def main [topic, closure] {
with-env {N: 5 REJECT: slow } {
print (echo $topic " tests" (char newline) | str join)
do $closure
}
}
export def scene [
topic: any
--tag: string
closure: closure
] {
print $" ($topic)(char newline)"
do $closure
}
export def play [
topic: any
--tag: string
closure: closure
] {
let is_tag_empty = ($tag | is-empty);
let should_run_all = ($env | get -i RUN_ALL | default false);
if $is_tag_empty {
do $closure $topic
} else {
if $tag == $env.REJECT and $should_run_all {
$" ($topic) ... (ansi yellow)skipped(ansi reset) (char newline)"
} else {
do $closure $topic
}
}
}
export def expect [
topic: string
actual: list<any>
--to-be: list<any>
] {
let are_equal = (($actual | length) == ($to_be | length)) and ($actual | zip $to_be | all {|case|
$case.0 == $case.1
}
)
let line = (if true == $are_equal {
$"(ansi green)ok(ansi reset)(char newline)"
} else {
$"(ansi red)failed(ansi reset)(char newline)"
}
)
$" ($topic) ... ($line)"
}