Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Pistonight committed Nov 22, 2023
0 parents commit d4dd7a4
Show file tree
Hide file tree
Showing 10 changed files with 402 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Rust
on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
name: Check, Build, Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: arduino/setup-task@v1
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: task check
- run: cargo build --release
- run: cargo test --release
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
223 changes: 223 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[package]
name = "magoo"
version = "0.0.0"
edition = "2021"
description = "A wrapper for git submodule that simplifies the workflows"
repository = "https://github.com/Pistonite/magoo"
license = "MIT"
authors = ["Pistonight <[email protected]>"]
keywords = ["git", "tool", "submodule"]
categories = ["development-tools"]
exclude = [
".github/**/*",
"Taskfile.yml"
]

[dependencies]
clap = { version = "4.4.8", features = ["derive"], optional = true }

[features]
default = ["cli"]
cli = ["dep:clap"]

[lib]
name = "magoo"
path = "src/lib.rs"

[[bin]]
name = "magoo"
path = "src/main.rs"
required-features = ["cli"]
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Pistonite

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
86 changes: 86 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# ![Magoo](./magoo.webp)
This ![](./magoo.webp) is Magoo, the cat that manages `git submodule` commands for you.

![magoo](./magoo.webp) is friendly for people who are familiar with other package
manager, such as `npm` or `cargo`.

![magoo](./magoo.webp) **does not like pipelines**. Please simply let your pipeline
checkout the submodules (recursively if needed). For example, if you are using GitHub Actions:
```yaml
- uses: actions/checkout@v4
with:
submodules: recursive
```
## Install ![magoo](./magoo.webp)
### ![magoo](./magoo.webp) As a CLI tool
```
cargo install magoo
```
### ![magoo](./magoo.webp) As dependency
The `--no-default-features` flag will turn off the `cli` feature flag,
which reduces the dependency.
```
cargo add magoo --no-default-features
```

## Use ![magoo](./magoo.webp) in CLI
![magoo](./magoo.webp) runs `git` commands using sub-processes,
so you must have `git` installed on the system.

Run `magoo git` to see the minimum supported `git` version and if it is installed on your system.

Run `magoo help` to see the full list of commands.

![magoo](./magoo.webp) will not commit any changes, but some commands may require staging certain files.
Be sure to check `git status` afterwards.

### Add a dependency
(This is similar to `npm install <package>` or `cargo add <package>`)

To add a dependency, ![magoo](./magoo.webp) needs to know:
- `URL`: The git URL like https://github.com/owner/repo
- `PATH`: The path in your repo the module should be at

```bash
magoo install URL PATH
magoo install URL PATH --branch BRANCH --name NAME --depth DEPTH --force
```

Run `magoo install help` to see other options

### Install the dependencies
(This is similar to `npm install`)

Similar to how one would run `npm install` after pulling from remote to get the dependencies
updated to the version specified in `package.json`, ![magoo](./magoo.webp) can do that for you as well.
```bash
magoo install
```

### Update dependencies
(This is similar to `npm update` or `cargo update`)

![magoo](./magoo.webp) can also update the dependency to the latest version tracked by the branch specified
when the dependency was added (or `HEAD` if it was not specified).

- Update all dependencies to the latest
```bash
magoo update
```
- Update one dependency to the latest
```bash
magoo update NAME
```
- Update one dependency, and also change the branch and/or url
```bash
magoo update NAME --branch BRANCH --url URL
```
### Remove dependencies
(This is similar to `npm uninstall` or `cargo remove`)

![magoo](./magoo.webp) understands your pain for removing submodules.
```bash
magoo remove NAME [--force]
```
`--force` will discard any changes made in the submodule (`git submodule deinit --force`)
Loading

0 comments on commit d4dd7a4

Please sign in to comment.