Skip to content

Commit

Permalink
chore: support for --version
Browse files Browse the repository at this point in the history
  • Loading branch information
anatawa12 committed Jan 25, 2023
1 parent ee59813 commit 8c416dc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name = "vrc-get"
version = "0.1.2-SNAPSHOT"
edition = "2021"

license = "MIT"
authors = ["anatawa12 <anatawa12@icloud.com>"]
description = "Open Source command line client of VRChat Package Manager."

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
Expand Down
11 changes: 10 additions & 1 deletion src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ macro_rules! multi_command {

/// Open Source command line interface of VRChat Package Manager.
#[derive(Parser)]
#[command(author, version, about)]
pub enum Command {
#[command(alias = "i")]
Install(Install),
Expand All @@ -36,12 +37,13 @@ multi_command!(Command is Install, Remove, Repo);

/// Adds package to unity project
#[derive(Parser)]
#[command(author, version)]
pub struct Install {
/// Name of Package
#[arg()]
name: Option<String>,
/// Version of package. if not specified, latest version will be used
#[arg()]
#[arg(id = "VERSION")]
version: Option<Version>,
/// Include prerelease
#[arg(long = "prerelease")]
Expand Down Expand Up @@ -87,6 +89,7 @@ impl Install {

/// Remove package from Unity project.
#[derive(Parser)]
#[command(author, version)]
pub struct Remove {
/// Name of Packages to remove
#[arg()]
Expand Down Expand Up @@ -114,6 +117,7 @@ impl Remove {

/// Commands around repositories
#[derive(Subcommand)]
#[command(author, version)]
pub enum Repo {
List(RepoList),
Add(RepoAdd),
Expand All @@ -126,6 +130,7 @@ multi_command!(Repo is List, Add, Remove, Cleanup, Packages);

/// List all repositories
#[derive(Parser)]
#[command(author, version)]
pub struct RepoList {}

impl RepoList {
Expand Down Expand Up @@ -159,6 +164,7 @@ impl RepoList {

/// Add remote or local repository
#[derive(Parser)]
#[command(author, version)]
pub struct RepoAdd {
/// URL of Package
#[arg()]
Expand Down Expand Up @@ -191,6 +197,7 @@ impl RepoAdd {

/// Remove repository with specified url, path or name
#[derive(Parser)]
#[command(author, version)]
pub struct RepoRemove {
/// URL of Package
#[arg()]
Expand Down Expand Up @@ -230,6 +237,7 @@ impl RepoRemove {
/// The official VPM CLI will add <uuid>.json in the Repos directory even if error occurs.
/// So this command will cleanup Repos directory.
#[derive(Parser)]
#[command(author, version)]
pub struct RepoCleanup {}

impl RepoCleanup {
Expand Down Expand Up @@ -278,6 +286,7 @@ impl RepoCleanup {

/// Remove repository from user repositories.
#[derive(Parser)]
#[command(author, version)]
pub struct RepoPackages {
name_or_url: String,
}
Expand Down

0 comments on commit 8c416dc

Please sign in to comment.