β― Cosmo
Git tooling of the future
New feature: Cosmo hooks!
Click here for more info!
π
Features
β― - Config files (with defaults!)
- Fast
- Easy to use
- Friendly errors (how to fix them included!)
- Multi branch support (defaults to the one you are on!)
- Beautiful, as if it just rolled in Cosmo!
- Cosmo Hooks (Git hooks but Cosmo)
π
Documentation
β― For proper docs, see here, this also includes examples.
β
What, how and why should you use Cosmo?
β― cosmo is a wrapper for Git essentially, allowing you to compress multiple commands into one. Cosmo is written in rust which not only makes it fast but also efficient. We simply parse your .cosmorc
(if it exists, if not it'll use the default config) and run a few git commands under the hood. Why? Simplicity. If you maintain a project, this is probably the thing for you.
π
Installation
β― Windows
scoop install cosmo
Linux
This is a bash script that can install on any platform other than windows, not just linux.
curl -fsSL https://raw.githubusercontent.com/Jacks123459/cosmo/master/install.sh | bash
Other
Check the releases and download the appropriate binary. Or build from source.
To build from source run this:
You need rust installed!
git clone https://github.com/Jacks123459/cosmo
cd cosmo
cargo install --path .
To update:
cd cosmo
git pull
cargo install --path .
π
Get started
β― We're so happy to see your interest in Cosmo! Leave a
Firstly, lets create a .cosmorc
- the configuration file for Cosmo.
The cosmorc is basically JSON but a fancy extension. If we want to make it so it automatically templates our commit message we can do it like so:
{
"commit_message": "$1($2): $3+"
}
and you can use it like so: cosmo push chore deps bump deps
, this would produce the message chore(deps): bump deps
. As you probably understand, $ is the prefix of arguments, ie, you can do $1 for the first argument, $2 for the second, etc. The + basically means all arguments after the one you specify will be placed there. Lets say we want it to be chore(Deps): bump deps
and it formats with that case. How? Easy. Lets add another key to our file:
{
...
"commit_message_arguments": []
}
inside this key we can then add the argument to configure, in this case, the 2nd one, let's add that.
{
...
"commit_message_arguments": [
{
"argument": 2
}
]
}
and then, to configure the case, add the key case
and watch the magic!
{
...
"commit_message_arguments": [
{
"argument": 2,
"case": "pascal"
}
]
}
Running cosmo push chore deps bump deps
would then give us the commit message of chore(Deps): bump deps
π·
FAQ
β― Does "this hello" count as 1 or 2 arguments?
This example counts as 1. For example cosmo push hello "world how" are you
would give the following arguments:
1: hello
2: world how
3: are
4: you
Why is it fast sometimes but not the next?
That's reliant on your internet connection. - We are just running git commands under the hood. Git will be the thing taking it's sweet time.
π£
Cosmo Hooks
β― Cosmo Hooks are Git hooks without the bash. Here is an example of how we can run cargo fmt
before commiting to this codebase.
{
...
"custom_tasks": [
{
"name": "fmt",
"execute": ["cargo fmt"]
}
],
"hooks": ["fmt"]
}
From this, before we commit, cargo fmt
will be executed. You can add more commands to be executed by simply adding another command to the fmt
field, or, adding another custom_task and referencing that in hooks. If you need help, you can make a discussion, and if you find a bug, please make a bug report!
π£
Available Cases
β― - lower
- upper
- snake
- screaming-snake
- kebab
- train
- sentence
- title
- class
- pascal
.. got a suggestion? Please make a discussion.
Installation errors are to go in issues.
Hope Cosmo helps you!