Skip to content

Commit

Permalink
feat: add create-rust-keybase-private-lib
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisGorbachev committed Aug 26, 2024
1 parent 9fa8180 commit 6765e08
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ All command arg options support the following substitutions:
* `create-rust-github-public-bin`
* `create-rust-github-public-lib`
* `create-rust-keybase-private-bin`
* `create-rust-keybase-private-lib`

## Gratitude

Expand Down
7 changes: 2 additions & 5 deletions src/bin/create-rust-keybase-private-bin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@ use std::io::{stderr, stdout};

use clap::Parser;

use create_rust_github_repo::CreateRustGithubRepo;
use create_rust_github_repo::{set_keybase_defaults, CreateRustGithubRepo};

fn main() -> anyhow::Result<()> {
CreateRustGithubRepo::parse()
.repo_exists_cmd("keybase git list | grep \" {{name}} \"")
.repo_create_cmd("keybase git create {{name}}")
.repo_clone_cmd("git clone $(keybase git list | grep \" {{name}} \" | awk '{print $2}') {{dir}}")
set_keybase_defaults(CreateRustGithubRepo::parse())
.project_init_cmd("cargo init --bin")
.run(&mut stdout(), &mut stderr(), None)
}
11 changes: 11 additions & 0 deletions src/bin/create-rust-keybase-private-lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
use std::io::{stderr, stdout};

use clap::Parser;

use create_rust_github_repo::{set_keybase_defaults, CreateRustGithubRepo};

fn main() -> anyhow::Result<()> {
set_keybase_defaults(CreateRustGithubRepo::parse())
.project_init_cmd("cargo init --lib")
.run(&mut stdout(), &mut stderr(), None)
}
7 changes: 7 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,13 @@ fn check_status(status: ExitStatus) -> io::Result<ExitStatus> {
}
}

pub fn set_keybase_defaults(create_repo: CreateRustGithubRepo) -> CreateRustGithubRepo {
create_repo
.repo_exists_cmd("keybase git list | grep \" {{name}} \"")
.repo_create_cmd("keybase git create {{name}}")
.repo_clone_cmd("git clone $(keybase git list | grep \" {{name}} \" | awk '{print $2}') {{dir}}")
}

const CARGO_PKG_REPOSITORY: &str = env!("CARGO_PKG_REPOSITORY");
const SUPPORT_LINK_FIELD_NAME: &str = "support_link_probability";
const MEGABYTE: usize = 1048576;
Expand Down

0 comments on commit 6765e08

Please sign in to comment.