Skip to content

A Zsh wrapper for Just, enabling custom commands without the need to write, modify, or extend a Justfile.

Notifications You must be signed in to change notification settings

swils23/just_wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Table of Contents↗️

Just Wrapper

A wrapper for Just, enabling custom commands without the need to write, modify, or extend a Justfile.

About The Project

just_wrapper is a wrapper for the just command in the form of a custom Zsh plugin. This plugin enables the use of custom commands without the need to write, modify, or extend a Justfile.

Use Cases

  • Custom Commands: Commands specific to your workflow, but don't belong in a project's Justfile
  • Overriding Commands: Commands that overwrite ones defined in a project's Justfile to suit your needs
  • Shortcut Commands: Commands that simplify or shorten existing commands (e.g. just tp for just test_playwright)
  • Roadblocks: Commands that are used frequently, but project maintainers are hesitant to add to the Justfile

Warning: Potential for Lost Wisdom

While just_wrapper offers great flexibility, there's a potential downside: lost wisdom. If team members add custom commands without sharing them, valuable improvements to a project's just commands might be missed. Encourage your team to share useful commands to ensure everyone benefits from collective knowledge.

Built With

  • Zsh
  • Bash

Getting Started

To install the just_wrapper plugin, follow these simple steps.

Prerequisites

just_wrapper requires the following to work:

Installation

  1. Install the plugin
    bash <(curl -s https://raw.githubusercontent.com/swils23/just_wrapper/main/install_script) "$ZSH_CUSTOM"
  2. (Recommended) Alias just to just_wrapper by adding the following line in ~/.zshrc:
    alias just=just_wrapper
  3. Finally, reload your shell by running
    exec $SHELL
Manual Installation 1. TODO

Usage

just_wrapper comes with a few built-in commands that can be used globally. These commands are:

  • just_wrapper_edit - Opens VS Code in the commands directory
  • just_wrapper_reload - Reloads the shell to apply changes
  • just_wrapper_update - Updates the plugin to the latest version

Adding Custom Commands

All commands are in the $ZSH_CUSTOM/plugins/just_wrapper/commands/ directory.

$ZSH_CUSTOM/plugins/just_wrapper/commands/
├── .commands - (add simple commands here by defining new functions)
├── example_command - (add more complex commands here as script files)
└── ...more scripts here

You can add custom commands to just_wrapper in two ways:

  • Defining functions in the .commands file

        # define commands here
    
        function custom_command() {
            echo "This is a custom command"
        }
    
        # ...
  • Adding scripts to the commands directory

These can all be called using just <command> (or just_wrapper <command> if you didn't alias just to just_wrapper).

~ ➜ just custom_command
This is a custom command

Planned Features

  • Project-specific commands (i.e. multiple just download_db that are specific to different projects)
  • Get aliases from ~/.zshrc working
  • Recursion for nested just_wrapper commands
  • Interactive installer to set up just_wrapper and aliases
  • Versioning
    • just --version or just just_wrapper_version
  • Handle scripts ending in .sh

See the open issues for a full list of proposed features (and known issues).

License

License

Contact

Sam Wilson - [email protected]

About

A Zsh wrapper for Just, enabling custom commands without the need to write, modify, or extend a Justfile.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages