summaryrefslogtreecommitdiff
path: root/src/parser.rs
diff options
context:
space:
mode:
authorJustin Wernick <justin@worthe-it.co.za>2023-04-11 21:57:23 +0200
committerJustin Wernick <justin@worthe-it.co.za>2023-04-11 21:57:23 +0200
commit56f1daaac2deeff57a8025024934e7adc91aced4 (patch)
tree69ea1faf835e01e416ab554608c917c5f3ab1486 /src/parser.rs
parente6ed91d0efab436c8a1ca4b6f701b6a9a4d96ccd (diff)
Add docs to all the commands
Diffstat (limited to 'src/parser.rs')
-rw-r--r--src/parser.rs55
1 files changed, 38 insertions, 17 deletions
diff --git a/src/parser.rs b/src/parser.rs
index 38b88f3..ebd860b 100644
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -8,59 +8,80 @@ use thiserror::Error;
#[derive(Parser, Clone, Debug, PartialEq, Eq)]
#[command(name = "")]
pub enum ShackleCommand {
- Exit,
+ /// Create a new repository
+ Init(InitArgs),
/// List all repositories available
List,
+ /// Sets the description of a repository, as shown in the CLI listing and web interfaces
SetDescription(SetDescriptionArgs),
+ /// Sets the main branch of the repository
SetBranch(SetBranchArgs),
- Init(InitArgs),
+ /// Quit the shell
+ Exit,
+ /// Server side command required to git fetch from the server
GitUploadPack(GitUploadPackArgs),
+ /// Server side command required by git push to the server
GitReceivePack(GitReceivePackArgs),
}
#[derive(Parser, Clone, Debug, PartialEq, Eq)]
+pub struct InitArgs {
+ /// Share repository ownership with the specified group (user must be a member of the group)
+ #[arg(long)]
+ pub group: Option<String>,
+ /// Sets the description of the repository, as shown in the CLI listing and web interfaces
+ #[arg(long)]
+ pub description: Option<String>,
+ /// Sets the main branch of the repository
+ #[arg(long, default_value = "main")]
+ pub branch: String,
+ /// Name of the new repository
+ pub repo_name: String,
+}
+
+#[derive(Parser, Clone, Debug, PartialEq, Eq)]
pub struct SetDescriptionArgs {
+ /// The full relative path of the repository, for example git/shuckie/repo.git
+ #[arg(value_parser = RelativePathParser)]
pub directory: PathBuf,
+ /// The new description
pub description: String,
}
#[derive(Parser, Clone, Debug, PartialEq, Eq)]
pub struct SetBranchArgs {
+ /// The full relative path of the repository, for example git/shuckie/repo.git
+ #[arg(value_parser = RelativePathParser)]
pub directory: PathBuf,
+ /// The new branch name
pub branch: String,
}
#[derive(Parser, Clone, Debug, PartialEq, Eq)]
-pub struct InitArgs {
- #[arg(long)]
- pub group: Option<String>,
- #[arg(long)]
- pub description: Option<String>,
- #[arg(long, default_value = "main")]
- pub branch: String,
- pub repo_name: String,
-}
-
-#[derive(Parser, Clone, Debug, PartialEq, Eq)]
pub struct GitUploadPackArgs {
- #[arg(long)]
+ /// Do not try <directory>/.git/ if <directory> is no Git directory
+ #[arg(long, default_value_t = true)]
pub strict: bool,
+ /// Always try <directory>/.git/ if <directory> is no Git directory - this argument is accepted for compatability with git, but is ignored
#[arg(long)]
pub no_strict: bool,
+ /// Interrupt transfer after <TIMEOUT> seconds of inactivity
#[arg(long)]
pub timeout: Option<u32>,
+ /// Perform only a single read-write cycle with stdin and stdout
#[arg(long)]
pub stateless_rpc: bool,
+ /// Only the initial ref advertisement is output, and the program exits immediately
#[arg(long)]
pub advertise_refs: bool,
+ /// The full relative path of the repository for example git/shuckie/repo.git
#[arg(value_parser = RelativePathParser)]
pub directory: PathBuf,
}
#[derive(Parser, Clone, Debug, PartialEq, Eq)]
pub struct GitReceivePackArgs {
- #[arg(long)]
- pub http_backend_info_refs: bool,
+ /// The full relative path of the repository for example git/shuckie/repo.git
#[arg(value_parser = RelativePathParser)]
pub directory: PathBuf,
}
@@ -139,7 +160,7 @@ mod test {
.parse::<ShackleCommand>()
.unwrap(),
ShackleCommand::GitUploadPack(GitUploadPackArgs {
- strict: false,
+ strict: true,
no_strict: false,
timeout: None,
stateless_rpc: true,