From 107024efbb61db8b1d10db5778458cd6c87a41f7 Mon Sep 17 00:00:00 2001 From: "Florine W. Dekker" Date: Fri, 16 Feb 2024 21:40:42 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=8C=B3=20mommy=20updates=20her=20readme?= =?UTF-8?q?=20and=20changelog~?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 11 +++++----- README.md | 57 ++++++++++++++++++++++++++++++++++++---------------- 2 files changed, 46 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d53d1a..176c648 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,13 @@ # Changelog ## [unreleased] ### added -* global config file! -* improved input validation -* improved links (back and forth from toc) in readme +* 🌍 mommy now supports a global config file that applies to all users, stored for example in `/usr/mommy/config.sh`~ ([#95](https://github.com/FWDekker/mommy/issues/95)) ([#96](https://github.com/FWDekker/mommy/issues/96)) +* 📏 mommy accepts long command-line options for all options (like `--config=` for `-c `)~ -### fixed -* an empty config file path is now interpreted as disabling the default config (but not necessarily the global config) +### changed +* đŸ•ŗī¸ mommy now interprets an empty config file path (`-c`) as you not wanting to use a config file~ +* ✅ mommy improved her input validation, giving clearer error messages when something is wrong~ +* 🏓 mommy improved the links to and from the table of contents in her readme~ ## [1.3.0] -- 2024-01-10 diff --git a/README.md b/README.md index ef48c2a..2e9f141 100644 --- a/README.md +++ b/README.md @@ -405,41 +405,64 @@ check out [how to use mommy](#usage), read all about [ways you can configure mom ## 📖 usage [top ▲](#toc) -mommy integrates with your normal command-line usage and compliments you if the command succeeds and encourages you if -it fails~ +mommy processes the output status of a command and compliments you if the command succeeds and encourages you if it +fails~ + +you can ask mommy to support you in a few ways, shown below. +alternatively, you can [integrate mommy into your shell](#shell-integration) so `mommy` is invoked for each command~ ```shell -$ mommy [-1] [-c config] [command] ... +$ mommy [command] ... # e.g. `mommy npm test` -$ mommy [-1] [-c config] -e eval +$ mommy -e eval # e.g. `mommy -e "ls -l | wc -l"` -$ mommy [-1] [-c config] -s status -# e.g. `mommy -s $?` +$ mommy -s status +# e.g. `mommy -s 0` or `mommy -s $?` ``` -by default, mommy outputs to stderr, but if you use `mommy -1 [other options]` she'll output to stdout~ +additionally, mommy knows a few extra options, which you can use to discover who mommy is and to tell mommy which +[configuration files](#configuration) she should use. -use `mommy -v` to see which version of mommy you're using~ +| short option | long option | description | +|--------------|-------------------------------|-------------------------------------------------------------------------------------------| +| `-h` | `--help` | opens mommy's manual page~ | +| `-v` | `--version` | displays version information~ | +| `-1` | | writes output to stdout instead of stderr~ | +| `-c ` | `--config=` | reads [config](#configuration) from ``~ | +| | `--global-config-dirs=` | sets global [configuration](#configuration) dirs to the colon-separated list in ``~ | ## 🙋 configuration [top ▲](#toc) -mommy's behavior can be configured by defining variables in `~/.config/mommy/config.sh`. - -> ℹī¸ mommy is used to instructions being scribbled down in unusual places, and will check inside `XDG_CONFIG_HOME` -> instead of `~/.config/` if the former is set~ - -you can specify a different config file by pointing the environment variable `MOMMY_OPT_CONFIG_FILE` to that file, or by -running mommy as `mommy -c ./my_config.sh [other options]`~ +mommy's behavior can be configured using config files. +the easiest way to do so is to add your config to the file `~/.config/mommy/config.sh`. +you can also set up a global config file that is applied to all users in `/etc/mommy/config.sh`. +mommy will explain in detail below~ + +### 🔍 config file locations +when mommy runs, she will first load the system-wide **global** config file. +after that, she will read the user-specific **local** config file, overriding the values from the global file~ + +* to find the **global** config file, mommy runs the following procedure. + 1. mommy determines the list of global config dirs. + 1. if a list is specified using a [command-line option](#usage), that list is used. + 2. otherwise, the list consists of all directories in `$XDG_CONFIG_DIRS`, plus `/etc/mommy`, plus + `/usr/local/etc/mommy/`. + 2. mommy traverses this list, and stops once she finds a directory that contains the file `config.sh`. + this file will be the global config file~ +* to find the **local** config file, mommy runs the following procedure. + 1. if a config file is specified using a [command-line option](#usage), that file is used. + 2. if `$XDG_CONFIG_HOME` is defined, the file `$XDG_CONFIG_HOME/mommy/config.sh` is used. + 3. otherwise, `$HOME/.config/mommy/config.sh` is used~ ### 🗃ī¸ config file format -mommy executes the config file as a shell script and keeps the environment variables. +mommy executes config files as shell scripts and keeps the environment variables. so, to change the value of `MOMMY_SWEETIE`, add the following line to your config file: ```shell MOMMY_SWEETIE="catgirl" ``` -make sure you do not put spaces around the `=`~ +make sure you _do not_ put spaces around the `=`, and you _do_ put quotes (`"`) around the value~ ### 👛 available settings | variable | description | list? | default |