{"id":13437014,"url":"https://github.com/pier-cli/pier","last_synced_at":"2025-04-04T20:14:44.194Z","repository":{"id":40601575,"uuid":"174017981","full_name":"pier-cli/pier","owner":"pier-cli","description":"A Linux script management CLI written in Rust","archived":false,"fork":false,"pushed_at":"2024-01-14T19:50:35.000Z","size":202,"stargazers_count":505,"open_issues_count":7,"forks_count":33,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-04-14T16:46:51.066Z","etag":null,"topics":["clis","linux","rust","tools"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pier-cli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-03-05T20:45:19.000Z","updated_at":"2024-04-29T07:52:34.662Z","dependencies_parsed_at":"2023-01-31T12:31:29.680Z","dependency_job_id":"b14c7f38-9be0-4072-926b-6df47997c072","html_url":"https://github.com/pier-cli/pier","commit_stats":null,"previous_names":["benschza/pier"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pier-cli%2Fpier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pier-cli%2Fpier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pier-cli%2Fpier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pier-cli%2Fpier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pier-cli","download_url":"https://codeload.github.com/pier-cli/pier/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247242680,"owners_count":20907134,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clis","linux","rust","tools"],"created_at":"2024-07-31T03:00:53.737Z","updated_at":"2025-04-04T20:14:44.177Z","avatar_url":"https://github.com/pier-cli.png","language":"Rust","readme":"# **pier** ~ A Linux script management tool\n[![Build Status](https://github.com/pier-cli/pier/actions/workflows/ci.yml/badge.svg)](https://github.com/pier-cli/pier/actions/workflows/ci.yml)\n![crates.io](https://img.shields.io/crates/v/pier.svg)\n\nA central repository to manage all your one-liners, scripts, tools, and CLIs. Add, remove, list, and run scripts - storing metadata to easily find them later. No more digging through your `bin` folder...\n\n![Boat pier](https://raw.githubusercontent.com/BenSchZA/pier/master/.media/boat-dock.png)\n\n## Description\n\nIf you've spent any amount of time in the terminal you no doubt have built up a lovely collection of one-liners, scripts, useful tools, and CLIs. Whenever you want to use them you dig through your `bin` folder trying to remember what you called the script... Linux users love hard-to-remember naming conventions.\n\nScripts should be first-class citizens. In a GUI world we can find our programs using a menu of sorts. In the terminal scripts get lost.\n\nThe idea behind `pier` is to create a central repository for all your scripts, and provide a way to attach metadata about these scripts. Using `pier` you can add, remove, list, and run scripts. These can be managed by `pier` in a human-readable TOML config, or you can use it to catalog existing scripts that you may have lying around - you'd then simply add the metadata for the specific script, and attach it to the name in the `PATH`.\n\n## Installation\n\nFrom **Crates.io**: `cargo install pier`\n\nFrom **GitHub release**: simply download the release binary\n\nUsing **Nix** package manager:\n1. From GitHub release: `make install` or `nix-env -if derivation.nix`\n2. From source: update `src` in derivation to `./.`\n\n\n## Recent Breaking Changes\n\n#### Version `0.1.4`:\nThe configuration variable `default_interpreter` has been _**removed**_:\n```toml\ndefault_interpreter = [\"foorunner\", \"-c\"]\n```\nSo when upgrading from to `0.1.4` from an earlier version you will need to instead specify the variable in this format:\n```toml\n[default]\ninterpreter = [\"foorunner\", \"-c\"]\n```\n\n## Operation\n\nUse `pier --help` to display help on commandline or see `src/cli.rs` for a more detailed spec.\n```\npier 0.1.4\nBenjamin Scholtz, Isak Johansson\nA simple script management CLI\n\nUSAGE:\n    pier [FLAGS] [OPTIONS] \u003calias\u003e\n    pier [FLAGS] [OPTIONS] \u003cSUBCOMMAND\u003e\n\nFLAGS:\n    -h, --help       \n            Prints help information\n\n    -V, --version    \n            Prints version information\n\n    -v, --verbose    \n            The level of verbosity\n\n\nOPTIONS:\n    -c, --config-file \u003cpath\u003e    \n            Sets a custom config file.\n            \n            DEFAULT PATH is otherwise determined in this order:\n            \n            - $PIER_CONFIG_PATH (environment variable if set)\n            \n            - pier.toml (in the current directory)\n            \n            - $XDG_CONFIG_HOME/pier/config.toml\n            \n            - $XDG_CONFIG_HOME/pier/config\n            \n            - $XDG_CONFIG_HOME/pier.toml\n            \n            - $HOME/.pier.toml\n            \n            - $HOME/.pier\n            \n             [env: PIER_CONFIG_PATH=]\n\nARGS:\n    \u003calias\u003e    \n            The alias or name for the script.\n\n\nSUBCOMMANDS:\n    add       Add a new script to config.\n    edit      Edit a script matching alias.\n    help      Prints this message or the help of the given subcommand(s)\n    list      alias: ls - List scripts\n    remove    alias: rm - Remove a script matching alias.\n    run       Run a script matching alias.\n    show      Show a script matching alias.\n```\n\n* `pier list`\n* `pier add \"ip link set wlp58s0 down \u0026\u0026 sleep 5 \u0026\u0026 ip link set wlp58s0 up\" --alias refresh-wifi`\n* `pier refresh-wifi`\n\n## Example `pier` TOML config\n\n```toml\n[scripts.refresh-wifi]\ncommand = \"ip link set wlp58s0 down \u0026\u0026 sleep 5 \u0026\u0026 ip link set wlp58s0 up\"\n\n[scripts.twa-analyze]\ncommand = \"docker run --rm -t trailofbits/twa -vw\"\ntags = [ \"infosec\" ]\n\n[scripts.enabled-services]\ncommand = \"systemctl list-unit-files --state=enabled\"\n\n[scripts.flush-docker]\ncommand = \"docker container stop $(docker container ls -a -q) \u0026\u0026 docker system prune -a -f --volumes\"\ndescription = \"A script to clear out old Docker containers and images\"\ntags = [ \"docker\", \"flush\" ]\n```\n\n## Example `pier list` output\n\n```\n▶ pier list           \n Alias             | Command \n-------------------+----------------------------------------------------------------------------------------------------------------\n fromscratch       | appimage-run ~/AppImage/FromScratch.1.4.3.AppImage \n nspawn-bionic     | sudo systemd-nspawn --bind=/tmp/.X11-unix -D /var/lib/machines/bionic --bind /home/bscholtz:/home/bscholtz \n bspwm-refresh     | .config/bspwm/bspwmrc \n flush-docker      | docker container stop $(docker container ls -a -q) \u0026\u0026 docker system prune -a -f --volumes \n zfs-compression   | sudo zfs get all | grep compressratio \n mongo-docker      | docker run --name mongodb -d mongo:latest \n forward-mongo     | kubectl port-forward mongo-molecule-set-0 27018:27017 \n refresh-wifi      | ip link set wlp58s0 down \u0026\u0026 sleep 5 \u0026\u0026 ip link set wlp58s0 up \n lepton            | appimage-run ~/AppImage/Lepton-1.8.0-x86_64.AppImage \n ledger            | appimage-run AppImage/ledger-live-desktop-1.6.0-linux-x86_64.AppImage \n reload-urxvt      | xrdb ~/.Xresources \n kill-docker       | rm -rf /var/lib/docker \n reload-xresources | xrdb ~/.Xresources \n graphiql          | appimage-run ~/AppImage/graphiql-app-0.7.2-x86_64.AppImage \n enabled-services  | systemctl list-unit-files --state=enabled \n ports             | netstat -tulpn \n chmod-copy        | chmod --reference= \n zfs-drop-caches   | sync; echo 2 | sudo tee /proc/sys/vm/drop_caches \n update            | sudo nix-channel --update \u0026\u0026 sudo nixos-rebuild switch \n flush-untagged    | docker images -q --filter dangling=true | xargs -r docker rmi \n twa-analyze       | docker run --rm -t trailofbits/twa -vw \n parity-ubuntu     | docker image pull yodascholtz/parity-ubuntu:latest \u0026\u0026 docker run -p 8545:8545 yodascholtz/parity-ubuntu:latest\n```\n## Execute pier scripts in any interpreted languages\nScripts starting with a shebang `#!` will be run with the specified interpeter just like it would in a normal script. Pier does this by creating a temp file from your script, executing it and then finally cleaning the file up. This allows you to write your pier script in python, node.js etc. even compiled languages can be run if using something like scriptisto.\n\n#### Shebang example config\n\n```\n[scripts.run_rust_script]\ncommand = '''\n#!/usr/bin/env scriptisto\n\n// scriptisto-begin\n// script_src: src/main.rs\n// build_cmd: cargo build --release \u0026\u0026 strip ./target/release/script\n// target_bin: ./target/release/script\n// files:\n//  - path: Cargo.toml\n//    content: |\n//     package = { name = \"script\", version = \"0.1.0\", edition = \"2018\"}\n//     [dependencies]\n// scriptisto-end\n\n\nfn main() {\n    println!(\"This is a rust script!\");\n}\n\n'''\n\n[scripts.run_python]\ncommand = '''\n#!/usr/bin/env python3\nimport sys\n\nprint(\"Running python with version {}\".format(sys.version))\n\n'''\n```\n\n### Setting the default shell / interpreter\nBy default if no shebang is specified pier will try to use your default shell to execute the script inline. This can be overwritten with the variable interpreter. It needs to be a list with the first item being the binary and the rest is any flags necessary.\n\n#### Default interpreter example config\n```\n# Sets the default interpreter, the first item in the list should be the binary and the rest are the arguments for the interpreter cli option.\n[default]\ninterpreter = [\"node\", \"-e\"]\n\n# Runs as the fallback interpreter nodejs as it's lacking a shebang\n[scripts.hello_world_nodejs]\ncommand = '''\nconsole.log(\"Hello world!\")\n\n'''\n\n# This will be run as a posix sh script as it has a shebang\n[scripts.a_shell_script]\ncommand = '''\n#!/bin/sh\n\nnohup st \u003e /dev/null 2\u003e\u00261\u0026\n\n'''\n```\n\n## Origin\n\nOriginally intended as a way to manage Docker one-liners, the name `pier` continues along the same maritime theme. I realized Pier can manage a lot more than just Docker scripts.\n\n## Roadmap to v1.0.0\n\n* Fuzzy search + autocomplete e.g. prompts for alias\n* Complete base features: mv, tag\n* Rework testing\n* Update documentation e.g. contributor guidelines, templates\n\n## Star History\n\n[![Star History Chart](https://api.star-history.com/svg?repos=pier-cli/pier\u0026type=Date)](https://star-history.com/#pier-cli/pier\u0026Date)\n","funding_links":[],"categories":["应用","Rust","Applications","应用程序 Applications","tools"],"sub_categories":["Productivity","生产力 Productivity"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpier-cli%2Fpier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpier-cli%2Fpier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpier-cli%2Fpier/lists"}