aheckmann / m

mongodb version management
MIT License
267 stars 55 forks source link

Update M_PREFIX behaviour to default to a writeable directory #54

Closed stennie closed 2 years ago

stennie commented 5 years ago

To simplify installation, the M_PREFIX environment variable should default to the user's home directory instead of /usr/local/. The /usr/local default originates from npm install -g.

Expected behaviour variation for npm installation:

Expected behaviour for install via wget:

General behaviour:

p-mongo commented 5 years ago

~/m is rather dangerous, I frequently use single and double letter directory names for things I work with often. ~/.m is a safer choice, there is also ~/.local that e.g. python uses hence ~/.local/m is perhaps an even better choice.

I would also expect non-mutating operations like m and m ls to work fine when the user invoking them does not have write access to /usr/local/m (but if the latter exists, I expect m to list versions installed therein).

stennie commented 5 years ago

@p-mongo Apparently .local is part of the XDG spec so that seems a reasonable default. Thanks for the suggestion!

Agree on behaviour for non-mutating operations: only need to exit with an error if write access is required and the destination path is non-writeable.

Regards, Stennie