scm
is a tool that aims to keep your workspace to be strongly organized.
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 -
go install github.com/pkorobeinikov/scm@latest
# 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)
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 ""
go build -o ~/Bin/scm main.go
go test -cover -v ./internal
Thank you for your attention! ๐ค
Any feedback will be highly appreciated. ๐