diff --git a/aliasman/README.md b/aliasman/README.md new file mode 100644 index 0000000..2312ce4 --- /dev/null +++ b/aliasman/README.md @@ -0,0 +1,77 @@ +--- +title: aliasman +homepage: https://github.com/BeyondCodeBootcamp/aliasman +tagline: | + aliasman: A cross-shell (POSIX-compliant) alias manager for bash, zsh, and fish +--- + +To update or switch versions, run `webi aliasman@stable` (or `@v1.0.0`, `@beta`, +etc). + +### Files + +These are the files / directories that are created and/or modified with this +install: + +```text +~/.config/envman/PATH.env +~/.config/envman/alias.env +~/.local/bin/aliasman +``` + +## Cheat Sheet + +> `aliasman` helps you love your *alias*es again! \ +> Set 'em once, use 'em everywhere! \ +> (and all in just one dotfile, for an on-the-go friendly config) + +```sh +# aliasman [args, pipes, redirs, etc] +aliasman ll 'lsd -lAhF' +``` + +Common aliases from around webi: + +```sh +aliasman curl 'curlie' + +alias diffy='diff -y --suppress-common-lines' + +alias la='lsd -AF' +alias ll='lsd -lAhF' +alias ls='lsd -F' + +alias tree='lsd -F --tree --group-dirs=last' + +# random password generator +alias rnd='xxd -l24 -ps /dev/urandom' +``` + +### How to replace an alias + +Just run the command again! + +```sh +aliasman ll 'lsd -l' +aliasman ll 'lsd -lAhF' +``` + +### How to delete an alias + +With `--delete`! + +```sh +aliasman --delete ll +``` + +### How to see an alias + +Just supply the name! + +```sh +aliasman rnd +``` + +```text +alias rnd='xxd -l24 -ps /dev/urandom' +``` diff --git a/aliasman/install.sh b/aliasman/install.sh new file mode 100644 index 0000000..b7c71d8 --- /dev/null +++ b/aliasman/install.sh @@ -0,0 +1,41 @@ +#!/bin/sh +set -e +set -u + +__init_aliasman() { + + ###################### + # Install aliasman # + ###################### + + # Every package should define these 6 variables + pkg_cmd_name="aliasman" + + pkg_dst_cmd="$HOME/.local/bin/aliasman" + pkg_dst="$pkg_dst_cmd" + + pkg_src_cmd="$HOME/.local/opt/aliasman-v$WEBI_VERSION/bin/aliasman" + pkg_src_dir="$HOME/.local/opt/aliasman-v$WEBI_VERSION" + pkg_src="$pkg_src_cmd" + + # pkg_install must be defined by every package + pkg_install() { + # ~/.local/opt/aliasman-v1.0.0/bin + mkdir -p "$(dirname "$pkg_src_cmd")" + + # mv ./*aliasman*/aliasman ~/.local/opt/aliasman-v1.0.0/bin/aliasman + mv ./*aliasman*/aliasman "$pkg_src_cmd" + } + + # pkg_get_current_version is recommended, but (soon) not required + pkg_get_current_version() { + # 'aliasman version' has output in this format: + # aliasman v1.0.0 (2023-01-15) + # Copyright 2023 AJ ONeal + # This trims it down to just the version number: + # 1.0.0 + aliasman version | head -n 1 | cut -d ' ' -f 2 | sed 's:^v::' + } +} + +__init_aliasman diff --git a/aliasman/releases.js b/aliasman/releases.js new file mode 100644 index 0000000..c55c48b --- /dev/null +++ b/aliasman/releases.js @@ -0,0 +1,28 @@ +'use strict'; + +var githubSource = require('../_common/github-source.js'); +var owner = 'BeyondCodeBootcamp'; +var repo = 'aliasman'; + +module.exports = function (request) { + let arches = [ + 'amd64', + 'arm64', + 'armv6l', + 'armv7l', + 'ppc64le', + 's390x', + 'x86', + ]; + let oses = ['freebsd', 'linux', 'macos', 'posix']; + return githubSource(request, owner, repo, oses, arches).then(function (all) { + return all; + }); +}; + +if (module === require.main) { + module.exports(require('@root/request')).then(function (all) { + all = require('../_webi/normalize.js')(all); + console.info(JSON.stringify(all, null, 2)); + }); +}