Skip to content

Commit 07b2aa1

Browse files
authoredApr 21, 2023
feat: support id field (#39)
Refs: #37
1 parent 04ed118 commit 07b2aa1

File tree

5 files changed

+15
-2
lines changed

5 files changed

+15
-2
lines changed
 

‎README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ cargo install --locked --git https://github.com/koyashiro/vpm-repos-gen
99
## Example
1010

1111
```sh
12-
vpm-repos-gen --name "koyashiro" --author 'koyashiro' --url 'https://vpm.koyashiro.net/repos.json' --repos 'koyashiro/udon-list,koyashiro/udon-dictionary'
12+
vpm-repos-gen --name "koyashiro" --author 'koyashiro' --url 'https://vpm.koyashiro.net/repos.json' --id 'net.koyashiro.vpm' --repos 'koyashiro/udon-list,koyashiro/udon-dictionary'
1313
```
1414

1515
<details>

‎src/args.rs

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ pub struct Args {
1414
#[arg(long, default_value = "")]
1515
pub url: String,
1616

17+
#[arg(long, default_value = "")]
18+
pub id: String,
19+
1720
#[arg(long, value_delimiter = ',')]
1821
pub repos: Vec<GitHubRepo>,
1922
}

‎src/generator.rs

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ impl VpmRepoGenerator {
2727
name: impl Into<String>,
2828
author: impl Into<String>,
2929
url: impl Into<String>,
30+
id: impl Into<String>,
3031
repos: Vec<GitHubRepo>,
3132
) -> Result<VpmRepos, GenerateError> {
3233
let mut packages: Packages = BTreeMap::new();
@@ -72,6 +73,7 @@ impl VpmRepoGenerator {
7273
name: name.into(),
7374
author: author.into(),
7475
url: url.into(),
76+
id: id.into(),
7577
packages,
7678
})
7779
}

‎src/main.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,14 @@ async fn main() -> Result<(), anyhow::Error> {
2020
let mut cache = Cache::load()?;
2121

2222
let vpm_repos = generator
23-
.generate(&mut cache, args.name, args.author, args.url, args.repos)
23+
.generate(
24+
&mut cache,
25+
args.name,
26+
args.author,
27+
args.url,
28+
args.id,
29+
args.repos,
30+
)
2431
.await?;
2532

2633
cache.save()?;

‎src/vpm.rs

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ pub struct VpmRepos {
1010
pub name: String,
1111
pub author: String,
1212
pub url: String,
13+
pub id: String,
1314
pub packages: Packages,
1415
}
1516

0 commit comments

Comments
 (0)
Please sign in to comment.