Skip to content

Latest commit

 

History

History
674 lines (576 loc) · 32.5 KB

README.md

File metadata and controls

674 lines (576 loc) · 32.5 KB

mommy 💝

github latest release mommy is on aur github ci status mommy is licensed under unlicense

mommy's here to support you! mommy will compliment you if things go well, and will encourage you if things are not going so well~

mommy is fully customizable, integrates with any shell, works on any system, and most importantly, loves you very much~ ❤️

mommy demo

🚚 installation

mommy works on any system. mommy is tested on ubuntu, debian, archlinux, fedora, macos, freebsd, netbsd, openbsd, and windows~

don't see your favourite distro or package manager listed? need help? otherwise not satisfied? please open an issue~

👩‍💼 with a package manager

alpine linux
  • homebrew (automatic updates)
    installs from the mommy tap. (requires brew.)
    brew tap fwdekker/mommy
    brew install mommy
    after installing, check the brew documentation on how to enable shell completions~
  • apk (github release) (manual updates)
    # download latest package from github release
    curl -s https://api.github.com/repos/FWDekker/mommy/releases/latest | grep "browser_download_url.*\.apk" | cut -d : -f 2,3 | tr -d \" | xargs curl -sLOJ
    # install package
    sudo apk add --allow-untrusted ./mommy-*.apk
arch linux
  • arch user repository (automatic updates)
    installs from the arch user repository, allowing for automatic updates. you should probably use an aur helper to do this:
    # if you use yay
    yay -S mommy
    # if you use paru
    paru -S mommy
    # if you use aura
    aura -A mommy
    # and so on
  • homebrew (automatic updates)
    installs from the mommy tap. (requires brew.)
    brew tap fwdekker/mommy
    brew install mommy
    after installing, check the brew documentation on how to enable shell completions~
  • pacman (github release) (manual updates)
    # download latest package from github release
    curl -s https://api.github.com/repos/FWDekker/mommy/releases/latest | grep "browser_download_url.*\.pacman" | cut -d : -f 2,3 | tr -d \" | xargs curl -sLOJ
    # install package
    sudo pacman -U ./mommy-*.pacman
debian/ubuntu/apt-based

subscribing to a repository (with automatic updates) is planned~

  • homebrew (automatic updates)
    installs from the mommy tap. (requires brew.)
    brew tap fwdekker/mommy
    brew install mommy
    after installing, check the brew documentation on how to enable shell completions~
  • apt (github release) (manual updates)
    # download latest package from github release
    curl -s https://api.github.com/repos/FWDekker/mommy/releases/latest | grep "browser_download_url.*\.deb" | cut -d : -f 2,3 | tr -d \" | xargs curl -sLOJ
    # install package
    sudo apt install ./mommy*.deb
freebsd
  • pkg (github release) (manual updates)
    # download latest package from github release
    curl -s https://api.github.com/repos/FWDekker/mommy/releases/latest | grep "browser_download_url.*\.freebsd" | cut -d : -f 2,3 | tr -d \" | xargs curl -sLOJ
    # install package
    sudo pkg add ./mommy-*.freebsd
macos
  • homebrew (automatic updates)
    installs from the mommy tap. (requires brew.)
    brew tap fwdekker/mommy
    brew install mommy
    after installing, check the brew documentation on how to enable shell completions~
  • pkg (github release) (manual updates)
    # download latest package from github release
    curl -s https://api.github.com/repos/FWDekker/mommy/releases/latest | grep "browser_download_url.*osx\.pkg" | cut -d : -f 2,3 | tr -d \" | xargs curl -sLOJ
    # install package
    sudo installer -pkg ./mommy*+osx.pkg -target /
netbsd
  • pkg_add (github release) (manual updates)
    # download latest package from github release
    curl -s https://api.github.com/repos/FWDekker/mommy/releases/latest | grep "browser_download_url.*netbsd\.tgz" | cut -d : -f 2,3 | tr -d \" | xargs curl -sLOJ
    # install package
    sudo pkg_add ./mommy-*+netbsd.tgz
openbsd
  • pkg_add (github release) (manual updates)
    # download latest package from github release
    curl -s https://api.github.com/repos/FWDekker/mommy/releases/latest | grep "browser_download_url.*openbsd\.tgz" | cut -d : -f 2,3 | tr -d \" | xargs curl -sLOJ
    # install package
    sudo pkg_add -D unsigned ./mommy-*+openbsd.tgz
red hat/fedora/rpm-based

since mommy is just a shell script these methods also work fine on opensuse~

  • dnf (copr) (automatic updates)
    installs from the copr repository, allowing for automatic updates. (requires the dnf-plugins-core package.)
    sudo dnf copr enable fwdekker/mommy
    sudo dnf install mommy
  • homebrew (automatic updates)
    installs from the mommy tap. (requires brew.)
    brew tap fwdekker/mommy
    brew install mommy
    after installing, check the brew documentation on how to enable shell completions~
  • dnf (github release) (manual updates)
    # download latest package from github release
    curl -s https://api.github.com/repos/FWDekker/mommy/releases/latest | grep "browser_download_url.*\.rpm" | cut -d : -f 2,3 | tr -d \" | xargs curl -sLOJ
    # install package
    sudo dnf install ./mommy-*.rpm
windows
  • wsl (automatic or manual updates)
    follow any of the mommy installation instructions for your installed linux subsystem (default is ubuntu) or build mommy from source~
  • msys2 (automatic or manual updates)
    follow any of the mommy installation instructions for arch linux (except do not use the arch user repository method) or build mommy from source~
  • cygwin (manual updates)
    there is no mommy package for cygwin. instead, you can build mommy from source (aka: run a script that copies a few files for you)~

🐐 without a package manager

build from source and install

if you want to customise where and how mommy installs, you can just compile her code yourself~

  1. prerequisites

  2. clone repository

    git clone https://github.com/FWDekker/mommy.git
    cd mommy
  3. install
    this step builds mommy's files and copies them into your system. the exact paths differ per system, so find the instructions that are right for your system.

    ℹ️ if you want to install mommy only for the current user, add prefix='~/.local/' before install~

    ℹ️ check the makefile for a list of all prefix variables you can override~

    • debian/ubuntu/apt-based
      sudo make zsh_prefix='$(prefix)/share/zsh/vendor-completions/' install
    • all other linux / windows
      sudo make install
    • macos/freebsd
      sudo gmake prefix='/usr/local/' install
    • netbsd
      sudo gmake prefix='/usr/pkg/' man_prefix='$(prefix)/man/'
    • openbsd
      sudo gmake prefix='/usr/local/' man_prefix='$(prefix)/man/'
  4. test (optional)
    if you want to make sure installation was successful, you can run tests using shellspec. run the following from inside the cloned mommy repository

    git clone https://github.com/shellspec/shellspec.git
    PATH="$(pwd)/shellspec/:$PATH" make test

    some tests will be skipped, depending on which other programs you have installed~

  5. uninstall (optional)
    if you want to uninstall after running make install, just run the same command as in step 3, except you replace install with uninstall. so on debian, you'd run sudo make zsh_prefix='$(prefix)/share/zsh/vendor-completions/' uninstall~

    uninstall might not work completely if you installed a different version than the one you're uninstalling. for the best results, run mommy -v, check the version number, run git checkout <the version>, and then perform the uninstallation~

use without installing

if you don't want to use a package manager but also don't want to bother with makeing mommy, you can download a universal build of mommy, and play around with that. this will not install any files into your system. if you're here because you want to install mommy only for a specific user, the "build from source and install" option is probably a better approach, though~

the script below downloads the latest stable release and extracts it for you. if you don't want to use curl, just check the latest release in your browser and download the +generic.tar.gz file manually~

# download latest archive from github release
curl -s https://api.github.com/repos/FWDekker/mommy/releases/latest | grep "browser_download_url.*generic\.tar\.gz" | cut -d : -f 2,3 | tr -d \" | xargs curl -sLOJ
# extract archive to `mommy`
tar -C ./ -xzf mommy-*.tar.gz
# invoke mommy
./mommy/usr/bin/mommy

🔮 what's next?

check out how to use mommy, read all about ways you can configure mommy, and integrate mommy with your shell~

mommy integrated with the fish shell

📖 usage

mommy integrates with your normal command-line usage and compliments you if the command succeeds and encourages you if it fails~

$ mommy [-1] [-c config] [command] ...
# e.g. `mommy npm test`

$ mommy [-1] [-c config] -e eval
# e.g. `mommy -e "ls -l | wc -l"`

$ mommy [-1] [-c config] -s status
# e.g. `mommy -s $?`

by default, mommy outputs to stderr, but if you use mommy -1 [other options] she'll output to stdout~

use mommy -v to see which version of mommy you're using~

🙋 configuration

mommy's behavior can be configured by defining variables in ~/.config/mommy/config.sh. or specify a different config file with mommy -c ./my_config.sh [other options]~

🗃️ config file format

mommy executes the config file as a shell script and keeps the environment variables. so, to change the value of MOMMY_SWEETIE, add the following line to your config file:

MOMMY_SWEETIE="catgirl"

make sure you do not put spaces around the =~

👛 available settings

variable description list? default
MOMMY_CAREGIVER what mommy calls herself yes mommy
MOMMY_PRONOUNS mommy's pronouns for herself. should be three words separated by spaces, as in they them their (subject, object, possessive) yes she her her
MOMMY_SWEETIE what mommy calls you yes girl
MOMMY_PREFIX what mommy puts at the start of each sentence yes <empty>
MOMMY_SUFFIX what mommy puts at the end of each sentence yes ~
MOMMY_CAPITALIZE 0 to start sentences in lowercase, 1 for uppercase, anything else to change nothing no 0
MOMMY_COLOR color of mommy's text. you can use any xterm color code, or write lolcat to use lolcat (install separately). specify multiple colors separated by / to randomly select one. set to empty string for your terminal's default color yes 005
MOMMY_COMPLIMENTS default compliment templates yes <various>
MOMMY_COMPLIMENTS_EXTRA additional compliment templates you can specify yes <empty>
MOMMY_COMPLIMENTS_ENABLED 1 to enable compliments, anything else to disable no 1
MOMMY_ENCOURAGEMENTS default encouragement templates yes <various>
MOMMY_ENCOURAGEMENTS_EXTRA additional encouragement templates you can specify yes <empty>
MOMMY_ENCOURAGEMENTS_ENABLED 1 to enable encouragements, anything else to disable no 1
MOMMY_FORBIDDEN_WORDS mommy will not use templates that contain forbidden / trigger words yes <empty>
MOMMY_IGNORED_STATUSES exit codes that mommy should never reply to. set to empty string to ignore nothing yes 130

🪣 lists

some of these settings support lists. mommy chooses a random element from each list each time she is called by you. (except for MOMMY_FORBIDDEN_WORDS and MOMMY_SUPPRESS_EXIT, where all elements of the list are always considered.) in a list, elements are separated by a newline or by a /. elements that contain whitespace only, and elements that start with a # are ignored~

  • for example, if you set
    MOMMY_SWEETIE="girl/kitten"
    then mommy will sometimes call you girl, and sometimes kitten~
  • if you set
    MOMMY_CAREGIVER="mommy
    mummy/#daddy/caregiver"
    then mommy will call herself mommy, mummy, or caregiver, but not daddy~
  • if you set
    MOMMY_PRONOUNS="she her her/they them their"
    then mommy may choose between mommy knows she loves her girl and mommy knows they love their girl~
  • if you set
    MOMMY_FORBIDDEN_WORDS="cat/dog"
    then mommy will never use templates that contain cat, and will never use templates that contain dog~

🧬 custom templates

you can add your own compliments to either MOMMY_COMPLIMENTS or MOMMY_COMPLIMENTS_EXTRA, but there is a slight difference:

  • if you want both the default and your own compliments, add your own compliments to MOMMY_COMPLIMENTS_EXTRA, but
  • if you want your own compliments and not the default compliments, add your own compliments to MOMMY_COMPLIMENTS~

and similarly so for encouragements~

📛 template variables

inside compliments and encouragements, you can put placeholders that contain the random values that mommy chose. for example, if you add the compliment %%CAREGIVER%% loves you, and have MOMMY_CAREGIVER=your mommy, then mommy outputs your mommy loves you~

variable description
%%CAREGIVER%% what mommy calls herself
%%THEY%% mommy's subject pronoun (e.g. he, she, they)
%%THEM%% mommy's object pronoun (e.g. him, her, them)
%%THEIR%% mommy's possessive pronoun (e.g. his, her, their)
%%SWEETIE%% what mommy calls you

✍️ renaming the mommy executable

if you want to write daddy npm test instead of mommy npm test, you can just create a symlink. mommy is installed in slightly different locations on different systems, but you can easily find where mommy is installed with whereis mommy:

$ whereis mommy
mommy: /usr/bin/mommy /usr/share/man/man1/mommy.1.gz

the exact format may differ depending on your system, but in this case you can see that the program is installed in /usr/bin/mommy and the manual page in /usr/share/man/man1/mommy.1.gz. if whereis mommy doesn't work, mommy is not on your path, but you can still find her with find / -name mommy~

anyway, after finding mommy, you can just symlink using the following commands: (if whereis gave different paths than seen above, you should adapt these commands accordingly)

sudo ln -fs /usr/bin/mommy /usr/bin/daddy
sudo ln -fs /usr/share/man/man1/mommy.1.gz /usr/share/man/man1/daddy.1.gz

🐚 shell integration

instead of calling mommy for each command, you can also fully integrate mommy with your shell to get mommy's output each time you run any command. here are some examples on how you can do that in various shells. recall that you can add MOMMY_COMPLIMENTS_ENABLED=0 to your mommy config file to disable compliments while keeping encouragements~

this is just a small list of possibilities. if you know of another way to integrate mommy, feel free to contribute them by opening a pull request!

🪅 bash

in bash you can set PROMPT_COMMAND to run mommy after each command. just add the following line to ~/.bashrc:

PROMPT_COMMAND="mommy -1 -s \$?; $PROMPT_COMMAND"
🐟 fish

in fish you can have mommy output a message on the right side of your prompt by creating ~/.config/fish/functions/fish_right_prompt.fish with the following contents:

function fish_right_prompt
    mommy -1 -s $status
end

if you have an oh my fish theme installed, check the docs of your theme to see if there's an easy way to extend the theme's right prompt. if not, you can either overwrite it with the above code, or copy-paste the theme's code into your own config file and then add mommy yourself~

💤 zsh

in zsh you can put mommy's output after each command by adding the following line to ~/.zshrc:

precmd() { mommy -1 -s $? }

to put mommy's output on the right side, add the following to ~/.zshrc:

set -o PROMPT_SUBST
RPS1='$(mommy -1 -s $?)'

unfortunately, the RPS1 solution does not work well with MOMMY_COLOR. instead, you'll have to use a special zsh syntax for xterm color codes by adding the following to your config:

MOMMY_COLOR=""
MOMMY_PREFIX="%F{005}/%F{006}"
MOMMY_SUFFIX="~%f"

this code randomly changes the output between magenta and cyan. note the %f in the suffix, which resets the color~

mommy integrated with the zsh shell
🐌 other shells

as a generic method, in any posix shell (including sh, ash, dash, bash) you can change the prompt itself to contain a message from mommy by setting the $PS1 variable:

PS1="\$(mommy -1 -s \$?)$PS1"

to improve the spacing, set MOMMY_SUFFIX="~ " in mommy's config file.

add the above line to the config file for your shell (e.g. .bashrc for bash) to apply it each time you open the shell. some shells (dash, pdksh) do not have a config file like .bashrc, but you can enable one by adding the following line to ~/.profile:

export ENV="$HOME/.shrc"

note that this will apply to all (non-login) posix shells that you open. after that, add the above-mentioned line that defines PS1 to ~/.shrc. log out and back in, and mommy will appear in your shell~

⚗️ development

this section explains how to build mommy from source, in case you want to help with development or for any other reason~

🎬 run

you can actually just directly run the script in src/main/sh/mommy. the only difference will be that the -h and -v options may not work correctly. if that annoys you, run make build after each change, and use build/bin/mommy instead~

🧪 tests

  1. requirements
    shellspec
  2. test local code
    1. all tests
      make test
    2. unit tests
      make test/unit
    3. integration tests
      make test/integration
  3. test installation
    make system=1 test
  4. configuration
    except for system=1, test behaviour is configured with environment variables. check the various files in src/test/ to find 'em all~

🏬 distribution

mommy is distributed in three ways:

  • attached as binary packages to each github release,
  • built on external build servers,
  • and available as source builds ("ports", basically) on a few servers.

let's go into them in more detail~

📦 binary packages

the binary packages attached to the github release are built with the makefile. run make list to see a list of build targets; you're looking for the ones starting with dist/~

to build the packages, you need at least gnu make, ruby, and fpm. (actually, you don't need fpm for netbsd and openbsd.) on debian-based systems, you already have gnu make, so you only need

sudo apt install ruby
sudo gem install fpm

after that, just run make dist/deb (or better: mommy make dist/deb), and a .deb package will be built in dist/. run make or make list for a list of valid building targets. a special target is install, which directly copies the files into the specified directories on your system. these directories can be changed by setting prefix variables, as in make prefix=/usr/ install. i recommend running make --dry-run prefix=/usr/ install first so you can verify that all directories are calculated correctly. check the GNUmakefile for more details~

all systems can build packages for themselves without additional dependencies. if you want to compile for a different system, you may need additional dependencies. for example, if you want to build packages for alpinelinux, archlinux, and rpm from a debian-like system, you will need

sudo apt install libarchive-tools rpm zstd

and then you can run

make apk pacman rpm

unfortunately, packages for macos, netbsd, and openbsd cannot be built on systems other than themselves~

🏗️ external build servers

a service builds mommy on-demand on each release, and makes the created packages available for all users. currently, this happens only for fedora/epel at copr. the relevant build files are hosted in mommy's pkg/rpm/ directory~

🌱 source builds

some servers host instructions on how to build mommy, but don't do any work beyond that. users connect to the server, get the latest instructions, and their system builds mommy for them locally~

📯 release

main always contains the latest stable version. every merge into main automatically build and releases a new version~

release checklists
  • before merging into main

    • update version~
    • update pkg/rpm/mommy.spec.rpkg~
      • update release number~
      • update change log~
    • update CHANGELOG.md~
      • do not leave a placeholder section for [Unreleased], because that will end up in the .deb changelogs~
      • remove empty subsections for the new release~
      • ensure no line breaks are used as whitespace; github release notes use them as actual line breaks~
    • update acknowledgements in README.md~
    • update promotional images in .github/img/~
  • after merging into main

🤠 contribution guidelines

thank you for considering contributing to mommy! below are some guidelines for contributions, but honestly, any contribution is welcome, even if it's broken, because surely we'll be able to figure something out together~

  • add relevant documentation and tests~
  • ensure that the tests pass (on your machine, at least)~
  • describe your changes in CHANGELOG.md~
  • your pull request should go into dev, not into main~

💖 acknowledgements

mommy recognises all contributors, no matter the size of the contribution. if mommy should add, remove, or change anything here, open an issue or contact the author~