{"id":13409664,"url":"https://github.com/junyu-w/corgi","last_synced_at":"2025-04-07T19:14:39.579Z","repository":{"id":57535264,"uuid":"135535614","full_name":"junyu-w/corgi","owner":"junyu-w","description":"Corgi is a command-line workflow manager that helps with your repetitive command usages by organizing them into reusable snippet","archived":false,"fork":false,"pushed_at":"2018-12-14T18:09:51.000Z","size":46303,"stargazers_count":389,"open_issues_count":7,"forks_count":13,"subscribers_count":12,"default_branch":"develop","last_synced_at":"2024-04-10T10:22:10.275Z","etag":null,"topics":["cli","command-line-tool","corgi","golang","snippet-manager","snippets","workflow"],"latest_commit_sha":null,"homepage":"","language":"Go","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/junyu-w.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}},"created_at":"2018-05-31T05:24:45.000Z","updated_at":"2024-04-05T01:13:35.000Z","dependencies_parsed_at":"2022-09-26T18:30:24.654Z","dependency_job_id":null,"html_url":"https://github.com/junyu-w/corgi","commit_stats":null,"previous_names":["drakew/corgi"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/junyu-w%2Fcorgi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/junyu-w%2Fcorgi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/junyu-w%2Fcorgi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/junyu-w%2Fcorgi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/junyu-w","download_url":"https://codeload.github.com/junyu-w/corgi/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247713258,"owners_count":20983683,"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":["cli","command-line-tool","corgi","golang","snippet-manager","snippets","workflow"],"created_at":"2024-07-30T20:01:02.626Z","updated_at":"2025-04-07T19:14:39.532Z","avatar_url":"https://github.com/junyu-w.png","language":"Go","funding_links":[],"categories":["Go","cli"],"sub_categories":[],"readme":"\n# Corgi - CLI workflow manager\n\n[![CodeFactor](https://www.codefactor.io/repository/github/drakew/corgi/badge)](https://www.codefactor.io/repository/github/drakew/corgi)\n[![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://github.com/DrakeW/corgi/blob/master/LICENSE)\n\n\u003cimg src=\"images/corgi-logo.png\" width=\"200\"\u003e\n\nCorgi is a command-line tool that helps with your repetitive command usages by organizing them into reusable snippet. See usage by simply running `corgi` or `corgi --help`\n\nCurrent version: **v0.2.4**\n## Examples\n\nCreate a new snippet to automate the commands you run repetitively\n\u003cimg src=\"images/corgi-new.gif\" width=\"900\"\u003e\n\nExecute an existing snippet knowing what command is being run and its output\n\u003cimg src=\"images/corgi-exec.gif\" width=\"900\"\u003e\n\n# Table of Contents\n\n- [Installation](#installation)\n    - [Install corgi](#install-corgi)\n        - [Homebrew](#homebrew)\n        - [Binary](#binary)\n        - [Build from scratch](#build-from-scratch)\n    - [Install a fuzzy-finder](#install-a-fuzzy-finder)\n- [Features](#features)\n    - [Create a snippet](#create-a-snippet)\n        - [Create from command history](#create-from-command-history)\n        - [Define template fields in snippet](#define-template-fields-in-snippet)\n        - [Multi-line command support](#multi-line-command-support)\n    - [List snippets](#list-snippets)\n    - [Execute a snippet](#execute-a-snippet)\n        - [Use default value without prompt](#use-default-value-without-prompt)\n        - [Select steps to execute](#select-steps-to-execute)\n        - [Interactive snippet selection](#interactive-snippet-selection)\n    - [Edit a snippet](#edit-a-snippet)\n    - [Describe a snippet](#describe-a-snippet)\n    - [Share snippets](#share-snippets)\n        - [Import snippets](#import-snippets)\n        - [Export snippets to JSON and SHELL script](#export-snippets-to-json-and-shell-script)\n    - [Remove a snippet](#remove-a-snippet)\n    - [Configure corgi](#configure-corgi)\n        - [Choose your favorite text editor](#choose-your-favorite-text-editor)\n        - [Choose your favorite fuzzy matcher](#choose-your-favorite-fuzzy-matcher)\n        - [Choose the directory to store all your snippets](#choose-the-directory-to-store-all-your-snippets)\n- [Roadmap](#roadmap)\n- [Note](#note)\n  \n## Installation\n\n### Install `corgi`\n\n#### Homebrew\nRun `brew install drakew/corgi/corgi` and you are good to roll!\n\n##### Upgrade Instruction\n\nUpgrade `corgi` from an old version by doing `brew upgrade drakew/corgi/corgi`\n\nIf you saw this error `Error: corgi \u003cold version\u003e is already installed` during installation or upgrade. Run the following commands to re-install:\n```\nbrew unlink corgi \u0026\u0026 brew uninstall corgi \u0026\u0026 brew install drakew/corgi/corgi\n```\n\n#### Binary\nTo install the binary directly:\n1. Download the latest package tarball from [releases](https://github.com/DrakeW/corgi/releases) based on your system (currently support linux and macOS).\n2. Unzip the package with `tar -xzvf \u003cdownloaded tar.gz file\u003e`\n3. `cd \u003cdirectory extracted\u003e`, and `chmod a+x ./corgi` to make sure execution bit is turned.\n4. `ln -s $(pwd)/corgi \u003cyour bin folder\u003e/corgi` to create a softlink\n5. Start rolling with `corgi`\n\n#### Build from scratch\nIf you would like to try some **pre-release** features, try building the executable from scratch:\n1. Install the most recent version of `go` language on your system\n2. `go get github.com/DrakeW/corgi`\n3. `go install github.com/DrakeW/corgi`\n\n### Install a fuzzy-finder\n`corgi` will enable interactive selection if you install a fuzzy finder, the currently supported two are [fzf](https://github.com/junegunn/fzf) and [peco](https://github.com/peco/peco).\n  \n## Features \nTo view usage of a specific action, run `corgi \u003caction\u003e --help`  \n  \n### Create a snippet\ncorgi provides an interactive CLI interface to create snippet, and you can start by running  \n```  \ncorgi new  \n```  \n**NOTE**: To create a snippet, `corgi` will need access to your command history file, which is being set by the `$HISTFILE` env variable. If `$HISTFILE` is not explicitly set, `corgi` will try to infer its location based on currently supported shell types (`bash`, `zsh` and `fish`).\n\n#### Create from command history\nIf you would like to quickly combine the last couple commands you just executed into a snippet, you could also run  \n```  \ncorgi new --last \u003cnumber of commands to look back\u003e  \n```  \n\n#### Define template fields in snippet\nFurthermore, you could also add template fields (with or without default value) to command of a step and reuse the same field, for example:  \n```  \ntar -xzf \u003cproject\u003e.tgz \u0026\u0026 scp \u003cproject\u003e \u003cuser=ec2-user\u003e@\u003cec2-instance-address\u003e:~/\n```\nAnd you will be prompted to enter values for those fields when the snippet executes. The value set for the same field name will be applied to **all steps** in a snippet, so you don't have to enter multiple times.\n\nAlso if you have field with **multiple default values**, the latest appearance will take precedence over the previous values.\n\n#### Multi-line command support\n`corgi` also supports multi-line command where each line has trailling character `\"\\\"`. For example,\n```\nStep 1:\nCommand: docker run -p 2181:2181 -p 9092:9092 \\\n\u003e --env ADVERTISED_HOST=\"172.17.0.1\" \\\n\u003e --env ADVERTISED_PORT=9092 \\\n\u003e --env NUM_PARTITIONS=\"2\" \\\n\u003e --env TOPICS=\"topic1,topic2\" \\\n\u003e spotify/kafka\n```\n\n### List snippets  \nTo view all snippets saved on your system, run  \n```  \ncorgi list  \n```  \n  \n### Execute a snippet\nTo execute a snippet, simply run  \n```  \ncorgi exec [\u003ctitle of the snippet\u003e] [--use-default] [--step \u003cstep range\u003e]\n```  \nYour commands will run smoothly just as they were being run on a terminal directly, and any prompt that asks for input (for example, password prompt when you `ssh` into a remote server) will work seamlessly as well.\n\nAlso note that if you run `cd` command in one of the steps, the current working directory will not change for subsequent steps. But you can always put `cd \u003ctarget dir\u003e \u0026\u0026 \u003cdo something else\u003e` to get commands executed inside of your target directory.\n\n#### Use default value without prompt\nif `--use-default` is set, then the snippet will execute without asking explicitly for user to set a value for template fields defined, but if there are missing default values, the snippet will fail fast and tell you what fields are missed.\n\n#### Select steps to execute\nYou can use the `--step` (or `-s`) flag to specify the steps (starting from index 1) you want to execute, for example\n```\n--step 3    # will only execute step 3\n--step 3-5  # will execute step 3 to 5\n--step 3-   # will execute step 3 to the last step\n```\nThis can be particularly useful when your workflow fail midway, but you don't want to start the whole workflow from step 1 again.\n\n#### Interactive snippet selection\nThis feature will guide you through the darkness if you don't have the title of your snippet memorized. Simply type\n```\ncorgi exec [with or without options]\n```\nand you will be presented an interactive interface to fuzzy-find your snippet (To enable this feature, see [installation instruction](#install-a-fuzzy-finder))\n\n\u003cimg src=\"images/corgi-fuzzy-select.gif\" width=\"700\"\u003e\n\n\n### Edit a snippet\nTo edit a snippet, run  \n```  \ncorgi edit [\u003ctitle of the snippet\u003e]  \n```  \nYou'll be able to edit the snippet json file directly with your preferred editor (configurable via `corgi config` command, details see below)\n\nFurthermore, `edit` also provides [fuzzy finding capabilities](#interactive-snippet-selection) when you omit the snippet title.\n\n### Describe a snippet\nTo see the details of a snippet, you can run (without title will yield interactive title selection)\n```\ncorgi describe [\u003ctitle of the snippet\u003e]\n```\nAnd it will print out each step of the snippet so that you don't have to memorize them.\n\n### Share snippets\n\n#### Import snippets\nIf someone shares his/her snippet json file(s) with you, you can import it by running\n```\ncorgi import \u003csnippet json file 1\u003e [\u003csnippet json file 2\u003e...]\n```\n#### Export snippets to `json` and `shell` script\nAnd similarly, if you already have a workflow defined in a snippet, you can easily share it by exporting via (without title will yield interactive title selection)\n```\ncorgi export [\u003ctitle of the snippet\u003e] [-o \u003coutput file path\u003e] [-t \u003cfile type: json|shell\u003e]\n```\nBy default a json file will be exported, but you can also export a shell script that can run in an environment where `corgi` is not installed, while still having the same organized step-by-step `corgi` experience. To export snippet to a shell script, just do\n```\ncorgi export [\u003ctitle of the snippet\u003e] -t shell\n```\n\n\u003cimg src=\"images/corgi-export-shell.gif\" width=\"700\"\u003e\n\n### Remove a snippet\nYou can remove a snippet by running (without title will yield interactive title selection)\n```\ncorgi remove [\u003ctitle of the snippet\u003e]\n```\n  \n### Configure `corgi` \nYou can configure corgi to use your existing tools or services and make it more usable (and fluffy)\n\n#### Choose your favorite text editor\nYou can configure your text editor choice (default is `vim`) for snippet editing, simply run  \n```  \ncorgi config --editor \u003ceditor of your choice, eg. vim, subl, atom, code etc\u003e\n```\n#### Choose your favorite fuzzy matcher\nYou can also choose your favorite filter tool (default is 'fzf') for interactive snippet selection by running\n```  \ncorgi config --filter-cmd \u003cfuzzy finder like fzf, peco etc\u003e\n```\n#### Choose the directory to store all your snippets\nYou can configure the path to store all your snippets by running\n```  \ncorgi config --snippets-dir \u003cpath, eg. ~/Dropbox/my_corgi_snippets\u003e\n```\nThis way, you can use online file sync/backup services like Dropbox, Box to make your snippet available across all your devices.\n\n## Roadmap  \nHere are some features that are currently on the roadmap:  \n1. Support concurrent execution of steps  \n2. Support remote server configuration, so that snippet can run seamlessly on a remote computer\n\n## Note\nCorgi is inspired by [Pet](https://github.com/knqyf263/pet), and aims to advance Pet's command-level usage to a workflow level.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjunyu-w%2Fcorgi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjunyu-w%2Fcorgi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjunyu-w%2Fcorgi/lists"}