Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mraerino/hacknow
⛏ Utility for automation of project directories and switching workspaces
https://github.com/mraerino/hacknow
cli git github idempotent utility workspaces
Last synced: 13 days ago
JSON representation
⛏ Utility for automation of project directories and switching workspaces
- Host: GitHub
- URL: https://github.com/mraerino/hacknow
- Owner: mraerino
- Created: 2017-09-04T00:33:18.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-09-25T20:02:26.000Z (about 7 years ago)
- Last Synced: 2024-10-06T04:01:31.427Z (about 1 month ago)
- Topics: cli, git, github, idempotent, utility, workspaces
- Language: JavaScript
- Homepage:
- Size: 2.93 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# HackNow
Utility for automation of project directories and switching workspaces based on the GitHub directory structure - `User/Project`
## Functionality
- Directory structure: `//`
- Checks if a directory for the specified repo exists
- No: Clones github repo into new directory
- Yes: Does `git fetch --all` for this repo
- Then changes into the project directory## Getting started
Available on npm:
`npm i -g hacknow`
### Shell function
If you want your shell to switch into the project directory, you need to create a small function inside your shell config (`.bashrc`, `.zshrc` or similar)
```sh
hn() {
PROJECTPATH=$(hacknow "$@")
RETVAL=$?
cd $PROJECTPATH
return $RETVAL
}
```Choose a different alias if `hn` doesn't work for you.
*Please note: On failure hacknow will echo just `.` to stdout, so it should be safe to call `cd` on it in every situation.*
## Usage
```sh
hacknow / # Plain (without dir change)
hn / # Needs a shell function (see above)
cd $(hacknow /) # Alternative if the shell function does not work for you
```### Options
```
-d|--project-dir Choose base directory for your projects (default: $HOME)
--ssh Use ssh protocol for git remote
```### Examples
```sh
$ hn mraerino/gitmoji
$ hn mraerino/hacknow -d ~/src
$ hn festify/app --ssh
```## Ideas / Roadmap
- Bash completion
- Execute scripts inside project directory (like `nvm`, `virtualenv`, `yarn install`, IDE launch...)