Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code cleanup #1

Merged
merged 2 commits into from
Jan 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
331 changes: 219 additions & 112 deletions Cargo.lock

Large diffs are not rendered by default.

32 changes: 17 additions & 15 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,35 @@ version = "3.1.23"
authors = ["Vanessa McHale <[email protected]>"]
description = "Quickly initialize projects from a template."
license-file = "LICENSE"
exclude = [ "./.gitignore" ]
exclude = ["./.gitignore"]
readme = "README.md"
repository = "https://github.com/vmchale/project-init"
documentation = "https://github.com/vmchale/project-init#README"
homepage = "https://github.com/vmchale/project-init"
build = "build.rs"
edition = "2021"

[build-dependencies]
cli-setup = "0.2"
cli-setup = "0.2.7"

[profile.release]
lto = true

[dependencies]
heck = "0.3"
case = "1.0"
toml = "0.5"
colored = "2.0"
clap = {version = "2.29", features = ["yaml"]}
time = "0.1"
rustache-lists = "0.1.0"
serde_derive = "1.0"
serde = "1.0"
text_io = "<= 0.1.6"
git2 = "0.13"
tempdir = "0.3"
dirs = "3.0"
cargo_toml = "0.11.3"
case = "1.0.0"
chrono = "0.4.19"
clap = { version = "3.0.13", features = ["derive"] }
colored = "2.0.0"
dirs = "4.0.0"
git2 = "0.13.25"
heck = "0.4.0"
rustache-lists = "0.1.2"
serde = "1.0.136"
serde_derive = "1.0.136"
tempdir = "0.3.7"
text_io = "0.1.9"
toml = "0.5.8"

[[bin]]
name = "pi"
Expand Down
1 change: 0 additions & 1 deletion rustfmt.toml

This file was deleted.

59 changes: 59 additions & 0 deletions src/args.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
use clap::{Parser, Subcommand};

#[derive(Subcommand, Debug)]
pub enum Subcommands {
/// Fetch a template from github.
#[clap(alias = "g")]
Git {
/// User and repository name where the template is located
#[clap(value_name = "USER/REPO")]
repo: String,
/// Project name to be used for project directory.
#[clap(value_name = "NAME")]
name: String,
/// Initialize project even if directory already exists.
#[clap(long, short)]
force: bool,
},
/// List available templates. User templates can be added by placing them in ~/.pi_templates
#[clap(alias = "l")]
List,
/// Update pi (only works on UNIX).
#[clap(alias = "u")]
Update {
/// Force installation even when binary already exists.
#[clap(long, short)]
force: bool,
},
/// Use a template from a folder.
#[clap(alias = "i")]
Init {
/// Directory containing your template, either in the current directory or in $HOME/.pi_templates/
#[clap(value_name = "TEMPLATE_DIR")]
directory: String,
/// Project name to be used for project directory.
#[clap(value_name = "NAME")]
name: String,
/// Initialize project even if directory already exists.
#[clap(long, short)]
force: bool,
},
/// Use a built-in template.
#[clap(alias = "n")]
New {
/// Template to used. Currently supported are Rust, Haskell, Idris, Elm, Python, Vimscript, Miso, and Julia.
template: String,
/// Project name to be used for project directory.
#[clap(value_name = "NAME")]
name: String,
/// Initialize project even if directory already exists.
#[clap(long, short)]
force: bool,
},
}
#[derive(Parser, Debug)]
#[clap(author, version, about, long_about = None, term_width = 80, after_help = "See 'man pi' for more information")]
pub struct Args {
#[clap(subcommand)]
pub subcommand: Subcommands,
}
Loading