/scm

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

Primary LanguageGoMIT LicenseMIT

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. ๐Ÿ˜Š