Skip to content

Commit cceecb2

Browse files
doc: update README
1 parent cb50791 commit cceecb2

6 files changed

+23
-21
lines changed

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,18 @@ create-rust-github-repo --name my-new-project --copy-configs-from ~/workspace/my
2424
create-rust-github-repo --name my-new-project --dir ~/workspace/my-new-project
2525

2626
# Create a public repo
27-
create-rust-github-repo --name my-new-project --public
27+
create-rust-github-repo --name my-new-project --repo-create-cmd "gh repo create --public {{name}}"
2828

2929
# Create a lib instead of bin
30-
create-rust-github-repo --name my-new-project --cargo-init-args '--lib'
30+
create-rust-github-repo --name my-new-project --project-init-cmd "cargo init --lib"
3131
```
3232

3333
## Features
3434

35-
* Uses existing `gh`, `git`, `cargo` commands
36-
* Forwards the flags to commands
37-
* Can be used as a library
35+
* [x] Uses existing `gh`, `git`, `cargo` commands
36+
* [x] Supports overrides for all commands
37+
* [x] Supports substitutions (see help below)
38+
* [x] Can be used as a library
3839

3940
## Installation
4041

README.ts

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env -S deno run --allow-read --allow-run=bash,git,cargo --allow-env --allow-sys
22

33
import * as zx from 'npm:zx'
4-
import { z, ZodSchema } from "https://deno.land/x/[email protected]/mod.ts";
4+
import { z, ZodSchema } from 'https://deno.land/x/[email protected]/mod.ts'
55
import { assertEquals } from 'https://jsr.io/@std/assert/1.0.0/equals.ts'
66

77
const CargoToml = z.object({
@@ -14,9 +14,9 @@ const CargoToml = z.object({
1414
title: z.string().min(1),
1515
tagline: z.string(),
1616
summary: z.string(),
17-
})
18-
})
19-
})
17+
}),
18+
}),
19+
}),
2020
})
2121

2222
type CargoToml = z.infer<typeof CargoToml>;
@@ -28,17 +28,17 @@ const Repo = z.object({
2828
type Repo = z.infer<typeof Repo>;
2929

3030
const $ = zx.$({
31-
cwd: import.meta.dirname
31+
cwd: import.meta.dirname,
3232
})
3333
const parse = <T>(schema: ZodSchema<T>, input: { toString: () => string }) => schema.parse(JSON.parse(input.toString()))
3434
const renderMarkdownList = (items: string[]) => items.map(bin => `* ${bin}`).join('\n')
3535

3636
const theCargoToml: CargoToml = parse(CargoToml, await $`yj -t < Cargo.toml`)
37-
const { package: {name, description, metadata: {details: {title}}} } = theCargoToml
37+
const { package: { name, description, metadata: { details: { title } } } } = theCargoToml
3838
const bin = name
3939
const help = await $`cargo run --quiet --bin ${bin} -- --help`
4040
const repo: Repo = parse(Repo, await $`gh repo view --json url`)
41-
const extraBins = (await $`find src/bin/*.rs -type f -exec basename {} .rs \\;`).valueOf().split("\n")
41+
const extraBins = (await $`find src/bin/*.rs -type f -exec basename {} .rs \\;`).valueOf().split('\n')
4242

4343
assertEquals(repo.url, theCargoToml.package.repository)
4444

@@ -73,17 +73,18 @@ ${bin} --name my-new-project --copy-configs-from ~/workspace/my-existing-project
7373
${bin} --name my-new-project --dir ~/workspace/my-new-project
7474
7575
# Create a public repo
76-
${bin} --name my-new-project --public
76+
${bin} --name my-new-project --repo-create-cmd "gh repo create --public {{name}}"
7777
7878
# Create a lib instead of bin
79-
${bin} --name my-new-project --cargo-init-args '--lib'
79+
${bin} --name my-new-project --project-init-cmd "cargo init --lib"
8080
\`\`\`
8181
8282
## Features
8383
84-
* Uses existing \`gh\`, \`git\`, \`cargo\` commands
85-
* Forwards the flags to commands
86-
* Can be used as a library
84+
* [x] Uses existing \`gh\`, \`git\`, \`cargo\` commands
85+
* [x] Supports overrides for all commands
86+
* [x] Supports substitutions (see help below)
87+
* [x] Can be used as a library
8788
8889
## Installation
8990

src/bin/create-rust-github-private-bin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use create_rust_github_repo::CreateRustGithubRepo;
44

55
fn main() -> anyhow::Result<()> {
66
CreateRustGithubRepo::parse()
7-
.project_init_cmd("gh repo create --private {{name}}")
7+
.repo_create_cmd("gh repo create --private {{name}}")
88
.project_init_cmd("cargo init --bin")
99
.run()
1010
}

src/bin/create-rust-github-private-lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use create_rust_github_repo::CreateRustGithubRepo;
44

55
fn main() -> anyhow::Result<()> {
66
CreateRustGithubRepo::parse()
7-
.project_init_cmd("gh repo create --private {{name}}")
7+
.repo_create_cmd("gh repo create --private {{name}}")
88
.project_init_cmd("cargo init --lib")
99
.run()
1010
}

src/bin/create-rust-github-public-bin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use create_rust_github_repo::CreateRustGithubRepo;
44

55
fn main() -> anyhow::Result<()> {
66
CreateRustGithubRepo::parse()
7-
.project_init_cmd("gh repo create --public {{name}}")
7+
.repo_create_cmd("gh repo create --public {{name}}")
88
.project_init_cmd("cargo init --bin")
99
.run()
1010
}

src/bin/create-rust-github-public-lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use create_rust_github_repo::CreateRustGithubRepo;
44

55
fn main() -> anyhow::Result<()> {
66
CreateRustGithubRepo::parse()
7-
.project_init_cmd("gh repo create --public {{name}}")
7+
.repo_create_cmd("gh repo create --public {{name}}")
88
.project_init_cmd("cargo init --lib")
99
.run()
1010
}

0 commit comments

Comments
 (0)