Skip to content

Guilospanck/workj

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

77 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

workj

Git worktrees in Zellij.

                                        __                
                                       |  \               
      __   __   __   ______    ______  | $$   __       __ 
     |  \ |  \ |  \ /      \  /      \ | $$  /  \     |  \
     | $$ | $$ | $$|  $$$$$$\|  $$$$$$\| $$_/  $$      \$$
     | $$ | $$ | $$| $$  | $$| $$   \$$| $$   $$      |  \
     | $$_/ $$_/ $$| $$__/ $$| $$      | $$$$$$\      | $$
      \$$   $$   $$ \$$    $$| $$      | $$  \$$\     | $$
       \$$$$$\$$$$   \$$$$$$  \$$       \$$   \$$__   | $$
                                                |  \__/ $$
                                                 \$$    $$
                                                  \$$$$$$ 
    
         workj — Git Worktree & Zellij Helper

Intro

A simplified way of using Git worktrees with Zellij.

Installing

git clone https://github.com/Guilospanck/workj.git
cd workj/
./install.sh

After that, you can run it following Usage section.

Configuration

Before using it, check if the default configs (/configs/*) make sense for you. If they don't, you can create a ~/.workj/config.cfg file or pass in via the CLI with the -c (or --config-file) option the path to where your custom config is located (check the workj -h to see options and how to use). The valid keys are displayed in /configs/workj_config.cfg.

  • main_branch is the start point for the new branch (if it doesn't exist). Default origin/main;
  • layout is the path to the Zellij layout you want to use when starting a new workj add <branch> command. Default configs/layout.kdl;
  • no_envs_copy: whether to copy the env files when creating a git worktree. false means that the env files will be copied. Default false.

Note

If you don't pass a config via the -c/--config-file option, it will check for it at the global level ~/.workj/config.cfg. If the config file doesn't exist there, the default values (the ones inside /configs/*) will be used.

Usage

Run workj -h for available commands and docs.

Note

When you run the add command, it creates a new worktree at $PROJECT_ROOT_LEVEL/../${PROJECT_NAME}__worktrees/${BRANCH_NAME} and open a new Zellij tab at that directory with panes based on the layout.kdl file.

Development

Build

Build it:

zig build
# just build

# For release:
zig build -Doptimize=ReleaseSafe
# just release

Run it:

./zig-out/bin/workj <commmand> <branch_name>

Or you can also do both of them in one line:

zig build run -- <command> <branch_name>
# just run <command> <branch>

Tests

You can run tests with:

zig build test
# just tests

Be aware that it will only print to stderr if there is an actual error in the test or if you did use something like std.debug.print.

Optionally, you can also run a specific test file with:

zig test <path_to_test_file>
# zig test src/git_test.zig

or all of them:

zig test src/tests.zig

Note

Each *_test.zig file you create, you MUST import it in src/tests/index.zig in order for the zig build test command to find it.

About

Git worktrees in Zellij.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published