2 releases (1 stable)

1.0.0 Nov 11, 2024
0.0.1 Nov 11, 2024

#182 in Development tools

Download history 207/week @ 2024-11-08 36/week @ 2024-11-15 7/week @ 2024-11-22 4/week @ 2024-11-29 5/week @ 2024-12-06

60 downloads per month

MIT license

27KB
519 lines

prj - Project Manager CLI

prj is a simple CLI tool for managing projects on your local machine. It allows you to add, list, remove, navigate to, and clone projects directly from GitHub. With built-in support for various project types (like Cargo and CMake), prj is designed to streamline your workflow.

Features

  • Add Projects: Easily add projects with a name, type, and path.
  • List Projects: View all added projects in a formatted, colored table.
  • Navigate to Projects: Quickly retrieve project paths for easy navigation.
  • Remove Projects: Remove projects by name or path.
  • Clone Repositories: Clone GitHub repositories and automatically add them as projects.
  • Setup Shortcut: Setup a pj shortcut for quick project navigation.

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/prj
    cd prj
    
  2. Build and install:

    cargo install --path .
    
  3. Run the setup to configure the pj shortcut:

    prj setup
    

    This will add a pj function to your shell (like .bashrc or .zshrc) for easier navigation. To activate it immediately, source your shell configuration file:

    source ~/.bashrc   # or source ~/.zshrc
    

Usage

prj <COMMAND> [OPTIONS]

Commands

add

Manually add a project with a specified name, type, and path.

prj add --name myproject --type Cargo --path /path/to/project
  • --name: Project name (optional, will prompt if missing)
  • --type: Project type (Cargo, CMake, etc.)
  • --path: Path to the project (defaults to current directory)

list

List all added projects in a formatted table.

prj list

print-path

Print the path of a specified project.

prj print-path --name myproject
  • --name: Name of the project

remove

Remove a project by its name or path.

prj remove --name myproject
  • --name: Name of the project (optional)
  • --path: Path of the project (optional)

Reorder

Reorder projects by their names.

prj reorder

clone

Clone a GitHub repository and automatically add it as a project.

prj clone https://github.com/author/repo --type Cargo --name customname --path /custom/path -- --branch main --depth 1
  • repo_url: URL of the GitHub repository to clone
  • --type: Project type (optional, defaults to Other)
  • --name: Custom name for the project (defaults to repository name)
  • --path: Custom path for the project (defaults to current directory)
  • git_options: Additional options for the git clone command, such as --branch and --depth.

setup

Sets up the project manager and adds a pj shell function for quick project navigation. Use this once after installation.

Example Workflow

  1. Add a Project:

    prj add --name myproject --type Cargo --path /home/user/myproject
    

    To add a project interactively, you can use prj add without any arguments.

  2. List Projects:

    prj list
    

    For an interactive list, you can use prj list --interactive, and multi selection can be enabled with prj list --interactive --multi.

  3. Clone a Repository:

    prj clone https://github.com/author/repo -- --branch main --depth 1
    
  4. Navigate to a Project with pj:

    pj myproject
    

    This will cd into the project directory if you sourced your shell configuration after running prj setup.

    An interactive project selection can be enabled by specifying no arguments:

    pj
    

License

This project is licensed under the MIT License. See LICENSE for details.

Dependencies

~15–30MB
~408K SLoC