Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
git_borg_linker
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LBMC
Hub
git_borg_linker
Commits
0af5d911
Commit
0af5d911
authored
3 years ago
by
nfontrod
Browse files
Options
Downloads
Patches
Plain Diff
src/main.rs: add create-hooks subcommand
parent
eefdd243
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main.rs
+20
-0
20 additions, 0 deletions
src/main.rs
with
20 additions
and
0 deletions
src/main.rs
+
20
−
0
View file @
0af5d911
...
...
@@ -2,6 +2,7 @@ use clap::{Args, Parser, Subcommand};
mod
checkout
;
mod
commit
;
mod
create_hooks
;
mod
init
;
mod
list
;
...
...
@@ -31,6 +32,15 @@ enum Commands {
/// Checkout results to the current git commit
#[clap(alias
=
"co"
)]
Checkout
(
Checkout
),
/// Create github hooks to use gbl automaticaly after commit, before and afetr checkout
///
/// This command should be used after git init and glb init.
/// This will create 3 hooks file:
/// 1. post-commit: `glb commit` will be launched after git commit
/// 2. pre-checkout: `glb pre-co` will be launched before git checkout
/// 3. post-checkout: `gbl checkout` will be launched after git checkout
#[clap(name
=
"create-hooks"
,
alias
=
"ch"
)]
CreateHooks
(
CreateHooks
),
}
#[derive(Debug,
Args)]
...
...
@@ -67,6 +77,13 @@ struct Checkout {
mode
:
String
,
}
#[derive(Debug,
Args)]
struct
CreateHooks
{
/// The compression that will automatically be used after each commit
#[clap(short,
long,
default_value
=
"lz4"
)]
compression
:
String
,
}
fn
main
()
{
let
args
=
Cli
::
parse
();
...
...
@@ -86,5 +103,8 @@ fn main() {
Commands
::
Checkout
(
co
)
=>
{
checkout
::
checkout
(
&
co
.mode
);
}
Commands
::
CreateHooks
(
ch
)
=>
{
create_hooks
::
create_hooks
(
&
ch
.compression
);
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment