-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
518b180
commit af8a65d
Showing
9 changed files
with
144 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[package] | ||
name = "shadcn" | ||
description = "Rust port of shadcn CLI." | ||
|
||
authors.workspace = true | ||
edition.workspace = true | ||
license.workspace = true | ||
repository.workspace = true | ||
version.workspace = true | ||
|
||
[dependencies] | ||
anyhow = "1.0.89" | ||
clap = { version = "4.5.4", features = ["cargo", "derive"] } | ||
env_logger = "0.11.3" | ||
log.workspace = true | ||
reqwest = { version = "0.12.4", features = ["gzip", "json"] } | ||
serde = { version = "1.0.203", features = ["derive"] } | ||
serde_json = "1.0.117" | ||
tokio = { version = "1.38.0", features = ["full"] } | ||
toml = "0.8.14" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
use anyhow::Result; | ||
use clap::{Args, Parser, Subcommand}; | ||
use shadcn::commands::init::{init, InitOptions}; | ||
|
||
#[derive(Parser)] | ||
#[command(version, propagate_version = true)] | ||
#[command(about = "add components and dependencies to your project")] | ||
// #[command(subcommand_required = true)] | ||
struct Cli { | ||
#[command(subcommand)] | ||
command: Commands, | ||
} | ||
|
||
#[derive(Subcommand)] | ||
enum Commands { | ||
#[command(about = "add a component to your project")] | ||
Add(AddArgs), | ||
#[command(about = "check for updates against the registry")] | ||
Diff(DiffArgs), | ||
#[command(about = "initialize your project and install dependencies")] | ||
Init(InitOptions), | ||
} | ||
|
||
#[derive(Args)] | ||
struct AddArgs {} | ||
|
||
#[derive(Args)] | ||
struct DiffArgs {} | ||
|
||
#[tokio::main] | ||
async fn main() -> Result<()> { | ||
env_logger::init(); | ||
|
||
let cli = Cli::parse(); | ||
|
||
match cli.command { | ||
Commands::Add(args) => Ok(()), | ||
Commands::Diff(args) => Ok(()), | ||
Commands::Init(args) => init(args).await, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
pub mod add; | ||
pub mod diff; | ||
pub mod init; |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use std::path::PathBuf; | ||
|
||
use anyhow::Result; | ||
use clap::Args; | ||
|
||
#[derive(Args)] | ||
pub struct InitOptions { | ||
#[arg(help = "the components to add or a url to the component.")] | ||
components: Vec<String>, | ||
|
||
#[arg(short, long, help = "skip confirmation prompt.")] | ||
yes: bool, | ||
|
||
#[arg(short, long, help = "use default configuration.")] | ||
defaults: bool, | ||
|
||
#[arg(short, long, help = "force overwrite of existing configuration.")] | ||
force: bool, | ||
|
||
#[arg( | ||
short, | ||
long, | ||
help = "the working directory. defaults to the current directory." | ||
)] | ||
cwd: PathBuf, | ||
|
||
#[arg(short, long, help = "mute output.")] | ||
silent: bool, | ||
|
||
#[arg(long, help = "use the src directory when creating a new project.")] | ||
src_dir: bool, | ||
} | ||
|
||
pub async fn init(options: InitOptions) -> Result<()> { | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub mod commands; |