Skip to content
/ afx Public

πŸ“¦ Package manager to provide declaretive way to manage CLI commands and shell plugins as code.

License

Notifications You must be signed in to change notification settings

babarot/afx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

4b34e4c Β· May 4, 2022
Mar 1, 2022
Mar 21, 2022
Mar 20, 2022
May 4, 2022
Jan 12, 2022
Feb 24, 2022
Feb 23, 2022
Mar 3, 2022
Mar 3, 2022
Mar 6, 2022
Mar 6, 2022
Jan 12, 2022
Mar 20, 2022

Repository files navigation

AFX - Package manager for CLI

AFX is a package manager for command-line tools and shell plugins. afx can allow us to manage almost all things available on GitHub, Gist and so on. Before, we needed to trawl web pages to download each package one by one. It's very annoying every time we set up new machine and also it's difficult to get how many commands/plugins we installed. So afx's motivation is coming from that and to manage them with YAML files (as a code).

Tests Release

Full document is here: AFX

Features

  • Allows to manage various packages types:
    • GitHub / GitHub Release / Gist / HTTP (web) / Local
  • Manages as CLI commands, shell plugins or both
  • Easy to install/update/uninstall
  • Easy to configure with YAML
    • Environment variables for each packages
    • Aliases for each packges
    • Conditional branches
    • Build steps
    • Run snippet code
    • Dependency between packages
    • etc...
  • Works on bash, zsh and fish

Quick Start

Details are here: Getting Started - AFX

1. Install packages

Write YAML file with name as you like in ~/.config/afx/. Let's say you write this code and then put it into github.yaml. After than you can install packages with install command.

+ github:
+ - name: stedolan/jq
+   description: Command-line JSON processor
+   owner: stedolan
+   repo: jq
+   release:
+     name: jq
+     tag: jq-1.5
+   command:
+     link:
+     - from: '*jq*'
+       to: jq
$ afx install

2. Load packages

You can enable installed packages to your current shell with this command:

$ source <(afx init)

Take it easy to run afx init because it just shows what to apply in your shell to Stdout.

If you want to automatically load packages when you start new shell, you need to add above to your shell-rc file.

3. Update packages

All you have to do for updating is just to update version part (release.tag) to next version then run update command.

  github:
  - name: stedolan/jq
    description: Command-line JSON processor
    owner: stedolan
    repo: jq
    release:
      name: jq
-     tag: jq-1.5
+     tag: jq-1.6
    command:
      link:
      - from: '*jq*'
        to: jq
$ afx update

4. Uninstall packages

Uninstalling is also almost same as install. Just to remove unneeded part from YAML file then run uninstall command.

- github:
- - name: stedolan/jq
-   description: Command-line JSON processor
-   owner: stedolan
-   repo: jq
-   release:
-     name: jq
-     tag: jq-1.6
-   command:
-     link:
-     - from: '*jq*'
-       to: jq
$ afx uninstall

Advanced tips

Shell completion

For zsh user, you can enable shell completion for afx:

$ source <(afx completion zsh)

bash and fish users are also available.

Installation

Download the binary from GitHub Release and drop it in your $PATH.

License

MIT