Skip to content

scm is a tool that aims to keep your workspace to be strongly organized

License

Notifications You must be signed in to change notification settings

petr-korobeinikov/scm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

scm 💪

Go Report Card

It's time 🕒 to clone ⤵️ interesting 🧐 repo faster ⏩ and clearer 🧹

scm is a tool that aims to keep your workspace to be strongly organized.

Usage example

Hi, folks!

I wrote a simple tool to obtain a working copy of any git repo.

My main purpose is to keep my workspace directory as clean as possible and strongly organized. Usually, your projects folder looks like this:

project-1
project-2
project-3
...

But I prefer a much more strong outline, like this:

> tree -L 2 ~/Workspace/
├── github.com
│   ├── VictoriaMetrics
│   ├── fluent
│   ├── github
│   ├── golang
...
├── hg.nginx.org
│   └── nginx
└── private-project-storage.tld
    └── private-project-team

Copy interesting repo URL and paste it into your terminal:

scm https://github.com/pkorobeinikov/scm

It will clone https://github.com/pkorobeinikov/scm into ~/Workspace/github.com/pkorobeinikov/scm.

It's also possible to clone hg-repo. So command:

scm hg http://hg.nginx.org/nginx

will clone scm hg http://hg.nginx.org/nginx/ into ~/Workspace/hg.nginx.org/nginx.

Trailing - allows omitting execution of post clone command.

scm https://github.com/github/gitignore -

installation

go install github.com/pkorobeinikov/scm@latest

Usage

# Clone repo and execute post command, see `SCM_POST_CLONE_CMD`
scm https://github.com/github/gitignore

# Show last cloned repo
scm last

# Omit post command execution, open project in Idea
scm https://github.com/github/gitignore -
idea $(scm last)

# Open in Goland
scm https://github.com/pkorobeinikov/scm
goland $(scm last)

Configuration

Put this into your .rc-file:

export SCM_WORKSPACE_DIR="~/Projects"         # defaults to ~/Workspace
export SCM_WORKSPACE_DIR_DEFAULT_PERM="0755"  # defaults to 0755

export SCM_POST_CLONE_CMD="idea {{.ScmWorkingCopyPath}}"  # defaults to ""

Building from source

go build -o ~/Bin/scm main.go

Running tests

go test -cover -v ./internal

Thank you for your attention! 🤝

Any feedback will be highly appreciated. 😊