Remix.run Logo
akdor1154 3 days ago

What i really want is a `mkdir --cd` - annoying to code without shadowing real mkdir though.

linsomniac 3 days ago | parent | next [-]

I have a shell function "md" that does a "mkdir -p" and then cds into it. In fish:

    function md
      if test -z "$argv"
        echo "md: Must supply an argument: The directory to create+cd into"
        return 1
      end
      mkdir -p "$argv"
      cd "$argv"
    end
quesera 3 days ago | parent | prev | next [-]

This works in sh, bash, zsh, etc:

  mkdircd() { mkdir -p "$1" && cd "$1" }

  mkdircd /tmp/new/directory/at/arbitrary/depth
ramon156 3 days ago | parent | prev [-]

it's weird how most IDE's already figured out people want this. I can type in "New File" > "/foo/bar/baz" and it will work just fine. Is there any limitation as to why mkdir can't support recursive generation?

dannyfritz07 3 days ago | parent | next [-]

mkdir -p

https://www.man7.org/linux/man-pages/man1/mkdir.1.html

johnisgood 3 days ago | parent [-]

I'm surprised people do not know about this.

Maybe that is why they love these CLI tools written by Rust. ;)

Learn your basic UNIX/POSIX utilities first, please, before you start preaching because of Rust. :D

metaltyphoon 3 days ago | parent [-]

> Learn your basic UNIX/POSIX utilities first, please, before you start preaching because of Rust. :D

Maybe, jus maybe the defaults for UNIX/POSIX was just not good and thats why they Rust based one?

johnisgood 3 days ago | parent [-]

Maybe, just maybe I could fork "mkdir" just for you and make "-p" the default, in C?

Or maybe, just maybe you could make an alias for it, i.e. "alias mkdir="mkdir -p" so then it becomes the default?

sighs.

skydhash 3 days ago | parent [-]

That is why I’m mostly using default tools. I like the idea of these tools, but autocomplete and fuzzy finding takes in aggregate more time than if I took a step back and actually configure my tools (shell alias and scripts, ssh config, git alias,…).

My current list of tools I install are:

- ripgrep. It’s just fast.

- fzf. For vim. I’ve never have a real use for it on the command.

- lf. Sometimes I want to quickly browse around a directory.

But more often than not, the core utilities work fine.

johnisgood 3 days ago | parent [-]

I use ripgrep and fzf as well. I have never heard of the last one.

But yeah, personally I just configure the default tools and be done with it for almost life. :D

3 days ago | parent | prev [-]
[deleted]