Skip to content

clotodex/project-chooser

Repository files navigation

Project Chooser

A tool for searching in your project folder

By clotodex

Features - How it works

When you have a projects folder where you have many projects or cloned repositories etc it quickly gets difficult to navigate the paths to get to that specific project you started two weeks ago.
This tool helps you by identifying all your projects and offering you search functionality.

You can place one of the following files into your directory to mark it as a project:

  • .project or .git - this will also exclude the directory from deeper indexing
  • .groupproject - this will tell the tool to also look fro other projects inside this directory

An example directory structure

projects
├── cloned_project/
│   └── .git/
├── parentProject/
│   ├── binary/
│   │   └── .git/
│   ├── library/
│   │   └── .git/
│   └── .groupproject
├── projectA/
│   └── .project
└── projectB/
    ├── data/
    └── .project

This wil find the following projects: cloned_project, parent_project, binary, library, projectA, projectB
The .project file in projectB also prevents the tool from searching through data/.

Because of this special indexing this tool is actually faster than GNU find (for this sepecific task).

For specific features please have a look at the Usage section

## Usage

You can call project-chooser --help at any point to get a full list of options.

Main usage:

project-chooser [OPTIONS] [query]

Options:

  • -b, --basename Search in path basenames instead of the whole path
  • -c, --cache Cache all project paths for future use
  • -h, --help Prints help information
  • -q, --quiet Silence all output
  • -V, --version Prints version information
  • -v Increase message verbosity (-vvvv = Trace-level)
  • -j, --jobs <jobs> Amount of threads to use (default: None)
  • -m, --mode <mode> How to handle multiple results (default: INTERACTIVE) [possible values: ALL, FIRST, INTERACTIVE]
  • -p, --path <path> Set root path for locating projects (default: "~/projects")

ARGS:

  • query: A string to search for - if omitted dmenu will be opened where you can search in all your projects interactively

Aliases

This tool outputs the path to the selected project.
Since I navigate my filesystem via the terminal on linux I can use aliases to call the tool and directly change the directory.
I you want to do this too, please have a look at the aliases file

You can also use the output to call any file-browser you like with the path. For windows for example you could write a .bat file calling the tool and starting explorer.exe with the path as an arg.

I can add all integration-scripts to this repository, just create an issue with the script.

Future ideas and TODOs

  • integrate notion properties to automatically create table and query views

  • create symlinks with UUID or hash of project in a top level folder -> so that links to projects work, no matter if they were moved

  • fuzzy readme search (combined with) file search

  • async display requests (scrolling might be slow)

  • make preview customizable (file regex -> preview command)

  • have support for .project contents, like autosource, etc

  • have project tags to filter by them (lazyly)

  • option to include external projects (or just add tag support in general

  • automatically activate virtualenv (.autosource)

  • validate current execution (can the cache handle multiple programs running at the same time)

  • proper return codes (no selection or error produces error code)

  • cache functionality (display cache and index projects in background, updating the cache)

  • save cache in "most recently" order and have a selection count => should add option to sort alphabetically as well

  • option for a dry-run only updating the cache (could be run via cronjob)

  • metainfo in cachefile (e.g. timestamp of last cache update => can decide based on time difference if another indexing is necessary)

  • multi-threading (is I/O the bottleneck or can I/O be done in multiple threads?)

  • make graphical selection a compile time feature

  • have other graphical options (gtk, qt, windows)

  • allow .git AND .groupproject

  • place performance results here

  • show an example project structure or even have a small gif showing the tool in action

  • have project information in .project (type, language, etc)

  • auto-detect project metadata (e.g. Cargo.toml is rust project)

  • above two lines could be outsourced into a seperate indexer => getting list of all directories from cache file

  • make use of this tool for batch processing - e.g. execute a script on every project root of a projecttype (specifically: 'cargo outdated' for every rust project)

  • .inactive file for projects not active anymore (can be optionally excluded)

Installation

The only soft dependency is the tool dmenu
The tool is only used if no query is given

Binary

TODO

Building from source

  1. install rust as shown here
  2. clone this repository
  3. run cargo build --release
  4. the binary is saved to /target/release/project-chooser

License

see LICENSE file

Contact me if you need a different license

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published