PitchHut logo
Log in / Sign up
dex
by symkat
Simplify command execution in project directories.
Pitch

dex is a powerful tool designed to streamline the execution of commands within project directories. Resembling make but with a simpler YAML configuration, dex handles nested commands and presents a user-friendly command menu. Written in Go, it requires only a single binary for installation, making it lightweight and efficient.

Description

dex is a powerful command execution tool designed to streamline tasks within project directories. It offers a simple and intuitive alternative to traditional build tools like make, allowing users to define commands in an easy-to-read YAML format. With support for nested commands, dex enhances productivity by providing a clear menu of executable options based on the current directory.

Key Features

  • User-Friendly YAML Configuration: Define commands effortlessly using .yaml files in your project directory. Examples include:
  - name: build
    desc: This command will build the project
    shell:
      - echo first command to run
      - echo second command to run
  • Command Management: Easily manage commands related to different environments, such as development and production. A sample DexFile configuration might look like:
  - name: run-playbook
    desc: "Run ansible playbook for dev environment"
    shell:
      - ansible-playbook -i env/dev/inventory.yml --vault-password-file .vault_password -e @env/dev/vault.yml site.yml
  • Nested Commands Support: Organize commands into logical groups. For example, the following nested commands facilitate managing both development and production workflows with ease:
- name: dev
  desc: "Commands on the development machine."
  children:
    - name: run-playbook
      desc: "Run the ansible playbook on the development machine."
      shell:
        -  ansible-playbook -i env/dev/inventory.yml --vault-password-file .vault_password -e @env/dev/vault.yml site.yml
    - name: edit-vault
      desc: "Edit the vault file."
      shell:
        - ansible-vault edit --vault-password-file .vault_password env/dev/vault.yml
    - name: encrypt-vault
      desc: "Encrypt the vault file."
      shell:
        - ansible-vault encrypt --vault-password-file .vault_password env/dev/vault.yml
    - name: decrypt-vault
      desc: "Decrypt the vault file."
      shell:
        - ansible-vault decrypt --vault-password-file .vault_password env/dev/vault.yml
- name: prod
  desc: "Manage the production cluster."
  children:
    - name: run-playbook
      desc: "Run the ansible playbook on the development machine."
      shell:
        -  ansible-playbook -i env/prod/inventory.yml --vault-password-file .vault_password -e @env/prod/vault.yml site.yml
    - name: edit-vault
      desc: "Edit the vault file."
      shell:
        - ansible-vault edit --vault-password-file .vault_password env/prod/vault.yml

Usage

Simply run dex in your terminal to view available commands and their descriptions. For example:

$ dex
dev                     : Commands on the development machine.
    run-playbook            : Run the ansible playbook on the development machine.
    edit-vault              : Edit the vault file.
    encrypt-vault           : Encrypt the vault file.
    decrypt-vault           : Decrypt the vault file.
prod                    : Manage the production cluster.
    run-playbook            : Run the ansible playbook on the development machine.
    edit-vault              : Edit the vault file.

Using dex, executing complex command sequences is streamlined and efficient, significantly reducing the overhead often associated with project setup and maintenance.

For more details on functionality and to explore the latest version of dex, visit the GitHub repository. In a development environment, simply executing commands like dex dev run-playbook or dex prod run-playbook enhances the deployment process, making management straightforward and efficient.

0 comments

No comments yet.

Sign in to be the first to comment.