Skip to main content
Prerequisites:
  • Rust toolchain (latest stable)
  • Git for version control
Follow these steps to set up dx for local development.
1

Clone the repository

git clone https://github.com/dx-cli/dx.git
cd dx
2

Build and install locally

Use the included install script for development builds:
# Build and install to ~/.local/bin (recommended)
./install.sh

# Uninstall
./uninstall.sh
The install script builds the project in release mode and copies the binary to ~/.local/bin/dx.

Development workflow

dx includes a built-in development menu accessible via the dx.yaml configuration:
# Build and install dx
dx build.install

# Run tests
dx test

# Run clippy for linting
dx clippy

Testing

Run the test suite:
cargo test
dx includes several test modules:
  • tests/exit_codes.rs - Exit code handling tests
  • tests/motd_asciinema_menu_markdown.rs - MOTD and markdown tests
  • tests/checks_and_router.rs - Menu and routing tests

Code structure

The dx codebase is organized as follows:
  • src/main.rs - Main entry point and CLI argument parsing
  • src/menu.rs - Menu system and item handling
  • src/exec.rs - Command execution and PTY management
  • src/markdown.rs - Markdown rendering
  • src/asciinema.rs - Recording and streaming integration
  • src/config.rs - Configuration management
  • src/screens/ - TUI screen implementations

Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/my-feature
  3. Make your changes and add tests
  4. Run cargo clippy -- -D warnings to check for issues
  5. Run cargo test to ensure all tests pass
  6. Submit a pull request

Troubleshooting

Make sure you have the latest stable Rust toolchain:
rustup update stable
Ensure ~/.local/bin is in your PATH:
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
If you get permission errors, the install script will automatically fall back to ~/.local/bin instead of system-wide installation.
Check the GitHub issues for known problems and solutions.