Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port before_v0.60/fuzzy, before_v0.60/ls-mods and before_v0.60/nu_101 #845

Merged
merged 13 commits into from
May 26, 2024

Conversation

39555
Copy link
Contributor

@39555 39555 commented May 25, 2024

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

  • fuzzy -> modules/fuzzy/fuzzy_command_search.nu
  • ls-mods -> modules/ls-mods: ls-less.nu, ls-wide.nu and ls-wide-with-color.nu
  • nu_101 -> modules/nu_101: nothing.nu and inner_outer_loop.nu

Edit: fuzzy and nu_101 have been moved to sourced

39555 added 7 commits May 13, 2024 00:43
- replace all `-` dashes in variable names with `_`
- merge `help commands | get subcommands` and `help commands | reject subcommands` together because now `help commands` contains the flatten data
- `$it.description` -> `$it.usage`
- `seq $required-tabs` -> `seq 0 $required-tabs`
- remove `echo $"(seq ...)"` ->  seq ...
- fix: assign fzf result to `let command` and then check with `is-not-empty` before sending to the `help` and the system clipboard
- `str collect` -> `str join`
- `get Column1` -> `get column1.0` explicitly get the first value from the table
- `empty?` -> `is-empty`
- `if {] {}` -> `if {} else {}`
- `empty?` -> `is-empty`
- remove `echo`
- remove additional `ansi_size` because `fill -l` already computes with ansi
- `if {} {}` -> `if {} else {}`
- remove empty else blocks
- `each -n` -> `enumerate | each`
- remove commented old code
- explicitly join together strings with `let new_line` and $"()()" instead of old implicit return. line 39
- `str rpad -c` -> `fill -a r -c`
- remove `autoview`
- `str collect` -> `str join`
- explicit `print`
- `if {} {}` -> `if {} else {}`
- remove logging
- `empty?` -> `is-empty`
- `each -n` -> `enumerate | each`
- remove autoview
- remove empty else blocks
- add missing `let is_columns_empty =` in the `run_ls` function
- `str collect` -> `str join`
- str rpad lpad` -> `fill`
- `str collect` -> `str join`
- `$()()(char newline)` ->  `$"()()"` and `str join (char newline)` do not print newline at the end, how it was in the old nu
- change flag -> optional positional argument for checking for the `null`. Flags now return a boolean value
- `if {} {}` -> `if {} else {}`
- remove unnecessary `echo`
- `empty?` -> `is-empty`
- `$true` `$false` -> `true` `false`
- `$nothing` -> `null`
@fdncred
Copy link
Collaborator

fdncred commented May 25, 2024

i noticed some files are just moved over without changes. does that mean they already work or are you continuing to work on these?

@39555
Copy link
Contributor Author

39555 commented May 25, 2024

I found that I should move nu_101 to sourced. I will fix that

- delete the duplicated README.md from the old module
- remove `demo.nu`. This script has already been ported to `sourced/nu_101/demo.nu`

- move `nothing.nu`
- move `inner_outer_loop.nu`
@39555 39555 marked this pull request as draft May 25, 2024 18:23
39555 added 3 commits May 25, 2024 22:27
- change `where` to `filter` for clarity, because we passing a closure
- check `--dir` if empty
@39555
Copy link
Contributor Author

39555 commented May 25, 2024

Fix missing files done.
also I've merged nu_101 scripts with nu_101 in sourced and moved fuzzy module to sourced

All 11 files that have been changed in this PR:

before_v0.60/fuzzy -> sourced/fuzzy

  • README.md I've moved it from before_v0.60 and removed mentions about config.toml
  • fuzzy_command_search.nu
  • fuzzy_history_search.nu does not need any changes

before_v0.60/nu_101 -> sourced/nu_101

  • README.md removed, already in sourced/nu_101
  • demo.nu removed, already in sourced/nu_101
  • nothing.nu
  • inner_outer_loop.nu

before_v0.60/ls-mods -> modules/ls-mods

  • ls-hidden.nu was missing the first time. Now I've ported it.
  • ls-less.nu
  • ls-wide-with-color.nu
  • ls-wide.nu

@39555 39555 changed the title Port before_v0.60/fuzzy, before_v0.60/ls-mods and before_v0.60/nu-101 Port before_v0.60/fuzzy, before_v0.60/ls-mods and before_v0.60/nu_101 May 25, 2024
@39555 39555 marked this pull request as ready for review May 25, 2024 19:16
@fdncred
Copy link
Collaborator

fdncred commented May 26, 2024

modules need to have export, sourced do not

39555 added 2 commits May 26, 2024 18:30
- move from `sourced/` to `modules/`
- add `export`
@39555
Copy link
Contributor Author

39555 commented May 26, 2024

I moved fuzzy into modules/, because it contains fuzzy related functions and functions that need to be private and added export in ls-mods and fuzzy

@fdncred fdncred merged commit e8df70a into nushell:main May 26, 2024
1 check failed
@fdncred
Copy link
Collaborator

fdncred commented May 26, 2024

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants