Skip to content

Commit

Permalink
1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
bwireman committed Jul 14, 2024
1 parent 30bd488 commit 4ba7ba6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion gleam.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name = "cactus"
version = "0.2.1"
version = "1.0.0"
licences = ["MIT"]
repository = { type = "github", user = "bwireman", repo = "cactus" }
description = "A tool for managing git lifecycle hooks with ✨ gleam! Pre commit, Pre push and more!"
Expand Down
18 changes: 12 additions & 6 deletions src/cactus.gleam
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import cactus/run
import cactus/util.{
type CactusErr, CLIErr, as_fs_err, err_as_str, join_text, print_warning, quote,
type CactusErr, CLIErr, as_fs_err, err_as_str, join_text, print_info,
print_warning, quote,
}
import cactus/write
import filepath
Expand Down Expand Up @@ -34,9 +35,9 @@ pub fn main() -> Result(Nil, CactusErr) {
let cmd = get_cmd()
let res = case cmd {
"help" | "--help" | "-h" -> {
util.print_info(
Ok(print_info(
"
🌵 Cactus (version: 0.2.1)
🌵 Cactus (version: 1.0.0)
---------------------------------------
A tool for managing git lifecycle hooks
with ✨ gleam! Pre commit, Pre push
Expand All @@ -49,25 +50,30 @@ Usage:
2. Run `gleam run -m cactus`
3. Celebrate! 🎉
",
)
Ok([])
))
}

"" | "init" -> write.init(hooks_dir, gleam_toml)
"" | "init" -> {
write.init(hooks_dir, gleam_toml)
|> result.replace(Nil)
}

arg ->
case write.is_valid_hook_name(arg) {
True -> run.run(gleam_toml, arg)
False -> Error(CLIErr(arg))
}
|> result.replace(Nil)
}

case res {
Ok(_) -> Nil

Error(CLIErr(err)) -> {
print_warning(err_as_str(CLIErr(err)))
shellout.exit(1)
}

Error(reason) -> {
[quote(cmd), "hook failed. Reason:", err_as_str(reason)]
|> join_text()
Expand Down

0 comments on commit 4ba7ba6

Please sign in to comment.