Skip to content

mkdir: make mkdir public and document it - #5329

Merged
cakebaker merged 1 commit into
uutils:mainfrom
kaathewisegit:main
Oct 10, 2023
Merged

cakebaker merged 1 commit into
uutils:mainfrom
kaathewisegit:main

Conversation

@kaathewisegit

@kaathewisegit kaathewisegit commented Sep 27, 2023 •

Copy link
Copy Markdown
Contributor
  • Made the mkdir function public. Added documentation, describing the behavior and parameters
  • Moved the GNU dot-stripping behavior from exec to mkdir.

@kaathewisegit
kaathewisegit marked this pull request as draft September 27, 2023 17:54
@kaathewisegit

Copy link
Copy Markdown
Contributor Author

@tertsdiepraam, opened the PR. It doesn't have much as of now, since I haven't made mkdir public.

Comment thread src/uu/mkdir/src/mkdir.rs Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// * `recurisve` --- create parent directories for the given dirs, if they do
/// * `recursive` --- create parent directories for the given dirs, if they do

@tertsdiepraam

Copy link
Copy Markdown
Collaborator

Thanks for opening the PR! For context for others, we were talking here: #5321.


A little recap:

The question is: what should be exposed? exec or mkdir?

  • exec: makes multiple directories and some GNU behaviour fix.
  • mkdir: makes a single directory.

Multiple directories is usually not good for nushell, because they what control over the errors and make them pretty with miette. So, we prefer not to print errors but to return them (with Result). Another question is whether the GNU behaviour is expected by nushell.


With that out of the way, here are my thoughts. I think it makes sense to expose a function for making a single directory and let nushell do the looping for good errors. I also think the GNU fix at least doesn't hurt for nushell, so I see no reason to exclude it.

So, in my opinion, the GNU fix is in the wrong spot: it should be in mkdir and then we can expose that.

- Made the `mkdir` function public.  Added documentation, describing the
  behavior and parameters
- Moved the GNU dot-stripping behavior from `exec` to `mkdir`.
@kaathewisegit kaathewisegit changed the title mkdir: make exec public and document it mkdir: make mkdir public and document it Sep 27, 2023
@kaathewisegit

Copy link
Copy Markdown
Contributor Author

Rewrote the commit:

  • Made mkdir public instead of exec.
  • Completed the documentation GNU behavior note.
  • Moved the GNU patch into mkdir.

Changed the PR name/description appropriately.

@kaathewisegit
kaathewisegit marked this pull request as ready for review October 9, 2023 15:53
@kaathewisegit

Copy link
Copy Markdown
Contributor Author

I think the PR is ready for review.

@tertsdiepraam tertsdiepraam left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I won't merge this myself because I'm reviewing from the GH app, but this looks great!

Comment thread src/uu/mkdir/src/mkdir.rs
/// ## Trailing dot
///
/// To match the GNU behavior, a path with the last directory being a single dot
/// (like `some/path/to/.`) is created (with the dot stripped).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Great comment here!

@cakebaker
cakebaker merged commit c70a47f into uutils:main Oct 10, 2023
@cakebaker

Copy link
Copy Markdown
Contributor

Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

4 participants