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

refactor: ✨ #418

Merged
merged 15 commits into from
Apr 25, 2023
Merged

refactor: ✨ #418

merged 15 commits into from
Apr 25, 2023

Conversation

melMass
Copy link
Contributor

@melMass melMass commented Mar 18, 2023

Warning
WIP PR, I'm just opening it so maintainers of the nu_scripts repo can have edit access to it.

Note
I think this is now in a good shape to be reviewed :)

Here is the renames for a simpler overview, the rest of the edits are properly commented , separated per commit:

Output of: git log $"(git merge-base FETCH_HEAD main)..HEAD" -M5 --summary | rg -e 'rename.*=>|delete mode' | lines | str trim | parse '{operation} {file}' | sort-by operation | save -f what_changed.csv

Expand for details...
╭─────┬───────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│   # │ operation │                                                   file                                                   │
├─────┼───────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│   0 │ delete    │ mode 100644 modules/formatting/README.md                                                                 │
│   1 │ rename    │ {modules/make_release => make_release}/20k_club.nu                                                       │
│   2 │ rename    │ {modules/make_release => make_release}/Readme.md                                                         │
│   3 │ rename    │ {modules/make_release => make_release}/gen-js-ext.nu                                                     │
│   4 │ rename    │ {modules/make_release => make_release}/get_coverage.nu                                                   │
│   5 │ rename    │ {modules/make_release => make_release}/nu_deps.nu                                                        │
│   6 │ rename    │ {modules/make_release => make_release}/nu_release.nu                                                     │
│   7 │ rename    │ {modules/make_release => make_release}/since_last_release.nu                                             │
│   8 │ rename    │ {modules/make_release => make_release}/this_week_in_nu_weekly.nu                                         │
│   9 │ rename    │ {bin => modules}/fun/wordle.nu                                                                           │
│  10 │ rename    │ {git => modules/git}/README.md                                                                           │
│  11 │ rename    │ {git => modules/git}/git.nu                                                                              │
│  12 │ rename    │ {git => modules/git}/git_branch_cleanup.nu                                                               │
│  13 │ rename    │ {prompt => modules/prompt}/README.md                                                                     │
│  14 │ rename    │ {prompt => modules/prompt}/async_git_prompt/README.md                                                    │
│  15 │ rename    │ {prompt => modules/prompt}/async_git_prompt/async-git-prompt.nu                                          │
│  16 │ rename    │ {prompt => modules/prompt}/async_git_prompt/prompt.nu                                                    │
│  17 │ rename    │ {prompt => modules/prompt}/full-line.nu                                                                  │
│  18 │ rename    │ {prompt => modules/prompt}/images/shell_space.png                                                        │
│  19 │ rename    │ {prompt => modules/prompt}/images/starship.png                                                           │
│  20 │ rename    │ {prompt => modules/prompt}/oh-my-minimal.nu                                                              │
│  21 │ rename    │ {prompt => modules/prompt}/oh-my-v2-docs.md                                                              │
│  22 │ rename    │ {prompt => modules/prompt}/oh-my-v2.nu                                                                   │
│  23 │ rename    │ {prompt => modules/prompt}/oh-my.nu                                                                      │
│  24 │ rename    │ {prompt => modules/prompt}/panache-git.nu                                                                │
│  25 │ rename    │ {prompt => modules/prompt}/shell_space.nu                                                                │
│  26 │ rename    │ {prompt => modules/prompt}/simple.nu                                                                     │
│  27 │ rename    │ {prompt => modules/prompt}/starship.nu                                                                   │
│  28 │ rename    │ {modules => sourced}/api_wrappers/wolframalpha.nu                                                        │
│  29 │ rename    │ {cool-oneliners => sourced/cool-oneliners}/README.md                                                     │
│  30 │ rename    │ {cool-oneliners => sourced/cool-oneliners}/cargo_search.nu                                               │
│  31 │ rename    │ {cool-oneliners => sourced/cool-oneliners}/clear_screen_buf.nu                                           │
│  32 │ rename    │ {cool-oneliners => sourced/cool-oneliners}/dict.nu                                                       │
│  33 │ rename    │ {cool-oneliners => sourced/cool-oneliners}/file_cat.nu                                                   │
│  34 │ rename    │ {cool-oneliners => sourced/cool-oneliners}/file_convert_naming_case.nu                                   │
│  35 │ rename    │ {cool-oneliners => sourced/cool-oneliners}/git_gone.nu                                                   │
│  36 │ rename    │ {cool-oneliners => sourced/cool-oneliners}/parse_fish_command_history.nu                                 │
│  37 │ rename    │ {cool-oneliners => sourced/cool-oneliners}/pwd-short.nu                                                  │
│  38 │ rename    │ {bin => sourced}/fehbg.nu                                                                                │
│  39 │ rename    │ {bin => sourced}/fun/website_builder.nu                                                                  │
│  40 │ rename    │ {modules => sourced}/github/branch-protections/README.md                                                 │
│  41 │ rename    │ {modules => sourced}/github/branch-protections/branch-protections.nu                                     │
│  42 │ rename    │ {modules => sourced}/github/branch-protections/branch-protections.yml                                    │
│  43 │ rename    │ {modules => sourced}/github/merged-branches/README.md                                                    │
│  44 │ rename    │ {modules => sourced}/github/merged-branches/merged-branches.nu                                           │
│  45 │ rename    │ {modules => sourced}/github/merged-branches/merged-branches.yml                                          │
│  46 │ rename    │ {modules => sourced}/gitlab/README.md                                                                    │
│  47 │ rename    │ {modules => sourced}/gitlab/gitlab.nu                                                                    │
│  48 │ rename    │ {imaging => sourced/imaging}/README.md                                                                   │
│  49 │ rename    │ {imaging => sourced/imaging}/divider.nu                                                                  │
│  50 │ rename    │ {imaging => sourced/imaging}/divider.sh                                                                  │
│  51 │ rename    │ {imaging => sourced/imaging}/imgcat.nu                                                                   │
│  52 │ rename    │ {imaging => sourced/imaging}/imgcat.sh                                                                   │
│  53 │ rename    │ {nu_101 => sourced/nu_101}/README.md                                                                     │
│  54 │ rename    │ {nu_101 => sourced/nu_101}/broken.nu                                                                     │
│  55 │ rename    │ {nu_101 => sourced/nu_101}/demo.nu                                                                       │
│  56 │ rename    │ {nu_101 => sourced/nu_101}/flag.nu                                                                       │
│  57 │ rename    │ {modules => sourced}/progress_bar/percent_meter.nu                                                       │
│  58 │ rename    │ {modules => sourced}/progress_bar/progress_bar.nu                                                        │
│  59 │ rename    │ {modules => sourced}/progress_bar/progress_bar_no_back.nu                                                │
│  60 │ rename    │ {modules => sourced}/webscraping/README.md                                                               │
│  61 │ rename    │ modules/webscraping/anagram_unscramble_scrape => sourced/webscraping/anagram_unscramble_scrape.nu        │
│  62 │ rename    │ {modules => sourced}/webscraping/nuschiit.nu                                                             │
│  63 │ rename    │ {modules => sourced}/webscraping/shell_stars.nu                                                          │
│  64 │ rename    │ {modules => sourced}/webscraping/twitter.nu                                                              │
│  65 │ rename    │ {modules => bin}/fun/website_builder.nu                                                                  │
│  66 │ rename    │ {modules => bin}/fun/wordle.nu                                                                           │
│  67 │ rename    │ {helpers => sourced}/README.md                                                                           │
│  68 │ rename    │ {helpers => sourced}/TODO.md                                                                             │
│  69 │ rename    │ {modules => sourced}/filesystem/cdpath.nu                                                                │
│  70 │ rename    │ {modules => sourced}/filesystem/up.nu                                                                    │
│  71 │ rename    │ {modules => sourced}/fun/spark.nu                                                                        │
│  72 │ rename    │ {misc => sourced/misc}/base64_encode.nu                                                                  │
│  73 │ rename    │ {misc => sourced/misc}/nu_defs.nu                                                                        │
│  74 │ rename    │ {helpers => sourced}/run-c-cpp.nu                                                                        │
│  75 │ rename    │ {helpers => sourced}/temp.nu                                                                             │
│  76 │ rename    │ {helpers => sourced}/todo.nu                                                                             │
│  77 │ rename    │ {helpers => sourced}/update-path.nu                                                                      │
│  78 │ rename    │ {helpers => sourced}/update_hosts.nu                                                                     │
│  79 │ rename    │ {modules => custom-completions}/just/just.nu                                                             │
│  80 │ rename    │ modules/{strings => formats}/remove-diacritics.nu                                                        │
│  81 │ rename    │ modules/{ssh => network}/ssh.nu                                                                          │
│  82 │ rename    │ {modules => hooks}/filesystem/autojump.nu                                                                │
│  83 │ rename    │ modules/{formatting/number-format.nu => formats/to-number-format.nu}                                     │
│  84 │ rename    │ {aws => aliases/aws}/select-aws-profile.nu                                                               │
│  85 │ rename    │ fehbg.nu => bin/fehbg.nu                                                                                 │
│  86 │ rename    │ {direnv => hooks/direnv}/config.nu                                                                       │
│  87 │ rename    │ {after => modules/after}/after.nu                                                                        │
│  88 │ rename    │ {api_wrappers => modules/api_wrappers}/wolframalpha.nu                                                   │
│  89 │ rename    │ {background_task => modules/background_task}/README.md                                                   │
│  90 │ rename    │ {background_task => modules/background_task}/job.nu                                                      │
│  91 │ rename    │ {base16 => modules/base16}/README.md                                                                     │
│  92 │ rename    │ {base16 => modules/base16}/alacritty_colors.mustache                                                     │
│  93 │ rename    │ {base16 => modules/base16}/auto_base16.nu                                                                │
│  94 │ rename    │ {base16 => modules/base16}/base16.nu                                                                     │
│  95 │ rename    │ {coloring => modules/coloring}/24bit-1.nu                                                                │
│  96 │ rename    │ {coloring => modules/coloring}/256_color_testpattern.nu                                                  │
│  97 │ rename    │ {coloring => modules/coloring}/README.md                                                                 │
│  98 │ rename    │ {coloring => modules/coloring}/hl.nu                                                                     │
│  99 │ rename    │ {coloring => modules/coloring}/html_colors.nu                                                            │
│ 100 │ rename    │ {data_extraction => modules/data_extraction}/ultimate_extractor.nu                                       │
│ 101 │ rename    │ {docker => modules/docker}/docker.nu                                                                     │
│ 102 │ rename    │ {filesystem => modules/filesystem}/autojump.nu                                                           │
│ 103 │ rename    │ {filesystem => modules/filesystem}/cdpath.nu                                                             │
│ 104 │ rename    │ {filesystem => modules/filesystem}/up.nu                                                                 │
│ 105 │ rename    │ {formats => modules/formats}/from-cpuinfo.nu                                                             │
│ 106 │ rename    │ {formats => modules/formats}/from-dmidecode.nu                                                           │
│ 107 │ rename    │ {formats => modules/formats}/to-ini.nu                                                                   │
│ 108 │ rename    │ {formatting => modules/formatting}/README.md                                                             │
│ 109 │ rename    │ {formatting => modules/formatting}/number-format.nu                                                      │
│ 110 │ rename    │ {fun => modules/fun}/spark.nu                                                                            │
│ 111 │ rename    │ {fun => modules/fun}/website_builder.nu                                                                  │
│ 112 │ rename    │ {fun => modules/fun}/wordle.nu                                                                           │
│ 113 │ rename    │ {github => modules/github}/branch-protections/README.md                                                  │
│ 114 │ rename    │ {github => modules/github}/branch-protections/branch-protections.nu                                      │
│ 115 │ rename    │ {github => modules/github}/branch-protections/branch-protections.yml                                     │
│ 116 │ rename    │ {github => modules/github}/merged-branches/README.md                                                     │
│ 117 │ rename    │ {github => modules/github}/merged-branches/merged-branches.nu                                            │
│ 118 │ rename    │ {github => modules/github}/merged-branches/merged-branches.yml                                           │
│ 119 │ rename    │ {gitlab => modules/gitlab}/README.md                                                                     │
│ 120 │ rename    │ {gitlab => modules/gitlab}/gitlab.nu                                                                     │
│ 125 │ rename    │ {make_release => modules/make_release}/gen-js-ext.nu                                                     │
│ 126 │ rename    │ {make_release => modules/make_release}/get_coverage.nu                                                   │
│ 127 │ rename    │ {make_release => modules/make_release}/nu_deps.nu                                                        │
│ 128 │ rename    │ {make_release => modules/make_release}/nu_release.nu                                                     │
│ 129 │ rename    │ {make_release => modules/make_release}/since_last_release.nu                                             │
│ 130 │ rename    │ {make_release => modules/make_release}/this_week_in_nu_weekly.nu                                         │
│ 131 │ rename    │ {maths => modules/maths}/math_functions.nu                                                               │
│ 132 │ rename    │ {network => modules/network}/remoting/README.md                                                          │
│ 133 │ rename    │ {network => modules/network}/remoting/remoting.nu                                                        │
│ 134 │ rename    │ {network => modules/network}/sockets/README.md                                                           │
│ 135 │ rename    │ {network => modules/network}/sockets/sockets.nu                                                          │
│ 142 │ rename    │ {ssh => modules/ssh}/ssh.nu                                                                              │
│ 143 │ rename    │ {strings => modules/strings}/remove-diacritics.nu                                                        │
│ 144 │ rename    │ {virtual_environments => modules/virtual_environments}/README.md                                         │
│ 145 │ rename    │ {virtual_environments => modules/virtual_environments}/auto-venv/README.md                               │
│ 146 │ rename    │ {virtual_environments => modules/virtual_environments}/auto-venv/auto-venv.nu                            │
│ 147 │ rename    │ {virtual_environments => modules/virtual_environments}/auto-venv/path_extensions.nu                      │
│ 148 │ rename    │ {virtual_environments => modules/virtual_environments}/auto-venv/venv_helpers.nu                         │
│ 149 │ rename    │ {virtual_environments => modules/virtual_environments}/auto-venv/venvs/python-venv.nu                    │
│ 150 │ rename    │ {virtual_environments => modules/virtual_environments}/conda.nu                                          │
│ 151 │ rename    │ {virtual_environments => modules/virtual_environments}/nu_conda/README.md                                │
│ 152 │ rename    │ {virtual_environments => modules/virtual_environments}/nu_conda/nu_conda.nu                              │
│ 153 │ rename    │ {virtual_environments => modules/virtual_environments}/nu_msvs/README.md                                 │
│ 154 │ rename    │ {virtual_environments => modules/virtual_environments}/nu_msvs/nu_msvs.nu                                │
│ 155 │ rename    │ {weather => modules/weather}/README.md                                                                   │
│ 156 │ rename    │ {weather => modules/weather}/get-weather.nu                                                              │
│ 157 │ rename    │ {weather => modules/weather}/nu.nu                                                                       │
│ 158 │ rename    │ {weather => modules/weather}/timed_weather_run.nu                                                        │
│ 159 │ rename    │ {weather => modules/weather}/timed_weather_run_env.nu                                                    │
│ 160 │ rename    │ {weather => modules/weather}/weatherdark.nu                                                              │
│ 161 │ rename    │ {webscraping => modules/webscraping}/README.md                                                           │
│ 162 │ rename    │ {webscraping => modules/webscraping}/nuschiit.nu                                                         │
│ 163 │ rename    │ {webscraping => modules/webscraping}/shell_stars.nu                                                      │
│ 164 │ rename    │ {webscraping => modules/webscraping}/twitter.nu                                                          │
├─────┼───────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│   # │ operation │                                                   file                                                   │
╰─────┴───────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────╯

Eveything in modules should probably be changed to `exported` defs.
The idea is to move everything first to keep proper history.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't work on version 0.76.1
Needs update to use main as module name.

Copy link
Contributor Author

@melMass melMass Mar 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an alias so it should be sourced, but there are a few issues that I'm not 100% sure about, cc @fdncred :

  • from ini is listed in the doc, but I don't have it locally, not sure if it's an optional feature. This comes from the nu_format plugin
  • It uses for in pipelines which apparently is not supported anymore, at least not as is

bin/fehbg.nu Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't work on version 0.76.1
Uses fetch instead of newer http get

replaced the template to use `main` and regenerated them
from lemnos themes.
@amtoine
Copy link
Member

amtoine commented Mar 19, 2023

the themes do not work on latest main but are being fixed in #402 👍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't work on version 0.76.1

@melMass
Copy link
Contributor Author

melMass commented Mar 19, 2023

the themes do not work on latest main but are being fixed in #402 👍

Nice I did not see that PR it's fixed in the last commit here too

@fdncred
Copy link
Collaborator

fdncred commented Mar 20, 2023

wow, this is a big commit. I'm wondering how we can manage this better. I mean, I expect that moving files around is a big commit and that's no biggy, but moving and changing files may be hard to manage. Thoughts?

@melMass
Copy link
Contributor Author

melMass commented Mar 20, 2023

wow, this is a big commit.

Yep the only reason is the themes that are all broken but solved in #402. I'm going to revert this commit so it's easier to navigate but not sure of the best approach either.
I was suggesting yesterday to split it up in multiple PRs.
This one can for instance just move files to modules, another one to actually fix the broken ones etc...

@fdncred
Copy link
Collaborator

fdncred commented Mar 20, 2023

I checked this PR out and I generally like the folder structure. However, I think it would be better to have a modules and sourced folders and have the scripts bucketed appropriately. If we convert the ones that need source to modules, then we can move them over to that folder. Otherwise, they should live in the sourced folder. Thoughts?

There are also a few stragglers that we may need to move. Maybe git should be in helpers or cool-oneliners. Now that I think about it. Everything in this repo is a helper. So, I'm not sure what helpers is about really. nu_101 seems out of place maybe. I think the rest are fine.

@melMass
Copy link
Contributor Author

melMass commented Mar 20, 2023

I think it would be better to have a modules and sourced folders and have the scripts bucketed appropriately.

That's a great idea to make the changes more progressively/in subsequent PRs to either fix or convert to module, I will do that today.

There are also a few stragglers that we may need to move. Maybe git should be in helpers or cool-oneliners. Now that I think about it. Everything in this repo is a helper. So, I'm not sure what helpers is about really. nu_101 seems out of place maybe. I think the rest are fine.

Agreed I haven't deeply tested the git "helpers" and wasn't sure where to put them yet :)

- Created a source `root` in which sourcable demos are stored.
  Some might get converted to modules later on.
- Moved some files to bin too.
@fdncred
Copy link
Collaborator

fdncred commented Mar 21, 2023

Thanks for the notes and moving some of the files. Looks like a good start. I'll keep watching.

@fdncred
Copy link
Collaborator

fdncred commented Apr 17, 2023

Totally love the idea of reorganizing but this is beginning to bit-rot. @melMass Do you think you'll have any more time to work on this in the near future?

@melMass
Copy link
Contributor Author

melMass commented Apr 17, 2023

@fdncred Indeed! I can rebase/update it before Wednesday.
I might poke you on discord then for a check

@fdncred
Copy link
Collaborator

fdncred commented Apr 17, 2023

sounds good. it should be pretty easy to separate modules from scripts just by looking for use

@melMass
Copy link
Contributor Author

melMass commented Apr 23, 2023

Merged main back!
If anyone has inputs on the moves don't hesitate, I'm going to try to dedicate a bit of time later today to review/update it.
Just a reminder as I'm not sure where we talked about this with @fdncred but the idea of this PR is to mostly move things first, a second PR (or mutiple) could be dedicated to fixing the ones that broke with recent updates

@fdncred
Copy link
Collaborator

fdncred commented Apr 24, 2023

@melMass I moved some other stuff around

@melMass
Copy link
Contributor Author

melMass commented Apr 24, 2023

@melMass I moved some other stuff around

You seem to have introduce conflicts or it's from other merge in main?

Edit: Actually looking at the history in main and the conflicting files in this PR I have no idea what happened. I will inverstigate this evening!

@fdncred
Copy link
Collaborator

fdncred commented Apr 24, 2023

I thought the conflicts are there because of another PR that has just landed that updated most of these files.

@melMass
Copy link
Contributor Author

melMass commented Apr 24, 2023

I thought the conflicts are there because of another PR that has just landed that updated most of these files.

Yep my bad! Commits from yesterday indeed, I'll solve it locally now!

@melMass melMass marked this pull request as ready for review April 24, 2023 18:14
Copy link
Collaborator

@Hofer-Julian Hofer-Julian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@fdncred fdncred merged commit c47ccd4 into nushell:main Apr 25, 2023
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.

None yet

5 participants