summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Wernick <justin@worthe-it.co.za>2023-04-09 22:21:41 +0200
committerJustin Wernick <justin@worthe-it.co.za>2023-04-09 22:21:41 +0200
commitd4f5206f4c409f3e3121e5f58cd6301284fd197f (patch)
treece925feabcb3b61ff0c7cbe4b51f5b3eb6c066a6
parent9d8995a8f64d589744c57abc9201b37e1442e0fb (diff)
Update naming of git-init to just init
-rw-r--r--readme.org4
-rw-r--r--src/lib.rs2
-rw-r--r--src/parser.rs4
-rw-r--r--tests/cli.rs28
-rw-r--r--tests/server_shell.rs4
5 files changed, 20 insertions, 22 deletions
diff --git a/readme.org b/readme.org
index acaca0c..9dc3eb8 100644
--- a/readme.org
+++ b/readme.org
@@ -39,8 +39,8 @@ Pijul.
- [X] set repo descriptions
- [X] init new repo
- [X] change an existing repo
-- [ ] Change ~git-init~ name to just be ~init~, with the ~git~ part being a VCS
- option.
+- [X] Change ~git-init~ name to just be ~init~. Later, the ~git~ part will be an
+ option which defaults to git.
- [ ] set the main branch of a repo
- [ ] help docs on all the commands
diff --git a/src/lib.rs b/src/lib.rs
index 60c5df5..196078c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -33,7 +33,7 @@ pub fn run_command(user_input: String) -> Result<ControlFlow<(), ()>, ShackleErr
git::set_description(&directory, &description)?;
println!("Successfully updated description");
}
- Ok(ShackleCommand::GitInit(GitInitArgs {
+ Ok(ShackleCommand::Init(InitArgs {
repo_name,
group,
description,
diff --git a/src/parser.rs b/src/parser.rs
index fd8ab75..14b1a49 100644
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -14,7 +14,7 @@ pub enum ShackleCommand {
/// List all repositories available
List,
SetDescription(SetDescriptionArgs),
- GitInit(GitInitArgs),
+ Init(InitArgs),
GitUploadPack(GitUploadPackArgs),
GitReceivePack(GitReceivePackArgs),
}
@@ -26,7 +26,7 @@ pub struct SetDescriptionArgs {
}
#[derive(Parser, Clone, Debug, PartialEq, Eq)]
-pub struct GitInitArgs {
+pub struct InitArgs {
#[arg(long)]
pub group: Option<String>,
#[arg(long)]
diff --git a/tests/cli.rs b/tests/cli.rs
index 56461ad..0e3ee58 100644
--- a/tests/cli.rs
+++ b/tests/cli.rs
@@ -118,7 +118,7 @@ fn can_init_a_new_git_repo() -> Result<()> {
let mut c = spawn_interactive_process()?;
let username = get_username().unwrap();
let repo_name = "my-new-repo";
- c.p.send_line(&format!("git-init {}", repo_name))?;
+ c.p.send_line(&format!("init {}", repo_name))?;
c.p.exp_string(&format!(
"Successfully created \"git/{}/{}.git\"",
username, repo_name
@@ -142,7 +142,7 @@ fn can_init_a_new_shared_git_repo() -> Result<()> {
let mut c = spawn_interactive_process()?;
let group = get_user_groups().into_iter().next().unwrap();
let repo_name = "my-new-shared-repo";
- c.p.send_line(&format!("git-init --group {} {}", group, repo_name))?;
+ c.p.send_line(&format!("init --group {} {}", group, repo_name))?;
c.p.exp_string(&format!(
"Successfully created \"git/{}/{}.git\"",
group, repo_name
@@ -166,7 +166,7 @@ fn does_not_init_shared_repo_if_the_user_isnt_in_the_group() -> Result<()> {
let mut c = spawn_interactive_process()?;
let group = "not-a-real-group";
let repo_name = "my-new-shared-repo";
- c.p.send_line(&format!("git-init --group {} {}", group, repo_name))?;
+ c.p.send_line(&format!("init --group {} {}", group, repo_name))?;
c.p.exp_string("Unknown group")?;
Ok(())
@@ -176,7 +176,7 @@ fn does_not_init_shared_repo_if_the_user_isnt_in_the_group() -> Result<()> {
fn runs_a_single_command_and_exit_with_cli_flag() -> Result<()> {
let username = get_username().unwrap();
let repo_name = "another-new-repo";
- let mut c = run_batch_command(&format!("git-init {}", repo_name))?;
+ let mut c = run_batch_command(&format!("init {}", repo_name))?;
c.p.exp_string(&format!(
"Successfully created \"git/{}/{}.git\"",
username, repo_name
@@ -189,7 +189,7 @@ fn runs_a_single_command_and_exit_with_cli_flag() -> Result<()> {
fn allows_quotes_arguments() -> Result<()> {
let username = get_username().unwrap();
let mut c = spawn_interactive_process()?;
- c.p.send_line("\"git-init\" 'another-new-repo'")?;
+ c.p.send_line("\"init\" 'another-new-repo'")?;
c.p.exp_string(&format!(
"Successfully created \"git/{}/another-new-repo.git\"",
username
@@ -200,7 +200,7 @@ fn allows_quotes_arguments() -> Result<()> {
#[test]
fn errors_with_an_open_double_quote() -> Result<()> {
let mut c = spawn_interactive_process()?;
- c.p.send_line("\"git-init 'another-new-repo'")?;
+ c.p.send_line("\"init 'another-new-repo'")?;
c.p.exp_string("Incomplete input")?;
Ok(())
}
@@ -208,7 +208,7 @@ fn errors_with_an_open_double_quote() -> Result<()> {
#[test]
fn errors_with_an_open_single_quote() -> Result<()> {
let mut c = spawn_interactive_process()?;
- c.p.send_line("'git-init 'another-new-repo'")?;
+ c.p.send_line("'init 'another-new-repo'")?;
c.p.exp_string("Incomplete input")?;
Ok(())
}
@@ -217,7 +217,7 @@ fn errors_with_an_open_single_quote() -> Result<()> {
fn allows_single_quotes_and_spaces_inside_double_quotes() -> Result<()> {
let username = get_username().unwrap();
let mut c = spawn_interactive_process()?;
- c.p.send_line("git-init \"shukkie's new repo\"")?;
+ c.p.send_line("init \"shukkie's new repo\"")?;
c.p.exp_string(&format!(
"Successfully created \"git/{}/shukkie's new repo.git\"",
username
@@ -258,7 +258,7 @@ fn list_can_print_a_list_of_personal_repos_with_descriptions() -> Result<()> {
let mut c = spawn_interactive_process()?;
let user = get_username().unwrap();
let personal_repo_name = "my-personal-repo";
- c.p.send_line(&format!("git-init {}", personal_repo_name))?;
+ c.p.send_line(&format!("init {}", personal_repo_name))?;
expect_list_table(
&mut c,
@@ -276,11 +276,11 @@ fn list_can_print_a_list_of_all_repos_with_descriptions() -> Result<()> {
let mut c = spawn_interactive_process()?;
let user = get_username().unwrap();
let personal_repo_name = "my-personal-repo";
- c.p.send_line(&format!("git-init {}", personal_repo_name))?;
+ c.p.send_line(&format!("init {}", personal_repo_name))?;
let group = get_user_groups().into_iter().next().unwrap();
let shared_repo_name = "my-shared-repo";
- c.p.send_line(&format!("git-init --group {} {}", group, shared_repo_name))?;
+ c.p.send_line(&format!("init --group {} {}", group, shared_repo_name))?;
expect_list_table(
&mut c,
@@ -305,9 +305,7 @@ fn can_set_the_description_on_a_repo_during_init() -> Result<()> {
let user = get_username().unwrap();
let repo_name = "my-personal-repo";
let description = "A cool repo that does cool things";
- c.p.send_line(&format!(
- "git-init --description \"{description}\" {repo_name}"
- ))?;
+ c.p.send_line(&format!("init --description \"{description}\" {repo_name}"))?;
c.p.exp_string(&format!(
"Successfully created \"git/{user}/{repo_name}.git\"",
))?;
@@ -329,7 +327,7 @@ fn can_change_the_description_on_a_repo() -> Result<()> {
let user = get_username().unwrap();
let repo_name = "my-personal-repo";
let description = "A cool repo that does cool things";
- c.p.send_line(&format!("git-init {repo_name}"))?;
+ c.p.send_line(&format!("init {repo_name}"))?;
c.p.exp_string(&format!(
"Successfully created \"git/{user}/{repo_name}.git\"",
))?;
diff --git a/tests/server_shell.rs b/tests/server_shell.rs
index d1453b1..bee0ed7 100644
--- a/tests/server_shell.rs
+++ b/tests/server_shell.rs
@@ -139,7 +139,7 @@ fn expect_prompt(p: &mut PtySession) -> Result<()> {
fn make_new_repo(c: &TestContext, repo_name: &str) -> Result<()> {
let mut p = connect_to_ssh_server_interactively(&c)?;
- p.send_line(&format!("git-init {}", repo_name))?;
+ p.send_line(&format!("init {}", repo_name))?;
p.exp_string(&format!(
"Successfully created \"git/shukkie/{}.git\"",
repo_name
@@ -152,7 +152,7 @@ fn make_new_repo(c: &TestContext, repo_name: &str) -> Result<()> {
fn make_new_shared_repo(c: &TestContext, group: &str, repo_name: &str) -> Result<()> {
let mut p = connect_to_ssh_server_interactively(&c)?;
- p.send_line(&format!("git-init --group {} {}", group, repo_name))?;
+ p.send_line(&format!("init --group {} {}", group, repo_name))?;
p.exp_string(&format!(
"Successfully created \"git/{}/{}.git\"",
group, repo_name