diff options
Diffstat (limited to 'crates/mozart/src')
35 files changed, 1672 insertions, 0 deletions
diff --git a/crates/mozart/src/commands.rs b/crates/mozart/src/commands.rs new file mode 100644 index 0000000..f31dd44 --- /dev/null +++ b/crates/mozart/src/commands.rs @@ -0,0 +1,230 @@ +pub mod about; +pub mod archive; +pub mod audit; +pub mod browse; +pub mod bump; +pub mod check_platform_reqs; +pub mod clear_cache; +pub mod config; +pub mod create_project; +pub mod depends; +pub mod diagnose; +pub mod dump_autoload; +pub mod exec; +pub mod fund; +pub mod global; +pub mod init; +pub mod install; +pub mod licenses; +pub mod outdated; +pub mod prohibits; +pub mod reinstall; +pub mod remove; +pub mod repository; +pub mod require; +pub mod run_script; +pub mod search; +pub mod self_update; +pub mod show; +pub mod status; +pub mod suggests; +pub mod update; +pub mod validate; + +#[derive(clap::Parser)] +#[command(name = "mozart", version, about = "A PHP dependency manager")] +pub struct Cli { + #[command(subcommand)] + pub command: Commands, + + /// Increase the verbosity of messages: 1 for normal, 2 for more verbose, 3 for debug + #[arg(short, long, action = clap::ArgAction::Count, global = true)] + pub verbose: u8, + + /// Display timing and memory usage information + #[arg(long, global = true)] + pub profile: bool, + + /// Disables all plugins + #[arg(long, global = true)] + pub no_plugins: bool, + + /// Skips execution of all scripts defined in composer.json + #[arg(long, global = true)] + pub no_scripts: bool, + + /// If specified, use the given directory as working directory + #[arg(short = 'd', long = "working-dir", global = true)] + pub working_dir: Option<String>, + + /// Prevent use of the cache + #[arg(long, global = true)] + pub no_cache: bool, + + /// Do not ask any interactive question + #[arg(short = 'n', long, global = true)] + pub no_interaction: bool, + + /// Do not output any message + #[arg(short, long, global = true)] + pub quiet: bool, + + /// Force ANSI output + #[arg(long, global = true)] + pub ansi: bool, + + /// Disable ANSI output + #[arg(long, global = true)] + pub no_ansi: bool, +} + +#[derive(clap::Subcommand)] +pub enum Commands { + /// Short information about Composer + About(about::AboutArgs), + + /// Creates an archive of this composer package + Archive(archive::ArchiveArgs), + + /// Checks for security vulnerability advisories for installed packages + Audit(audit::AuditArgs), + + /// Opens the package's repository URL or homepage in your browser + #[command(alias = "home")] + Browse(browse::BrowseArgs), + + /// Increases the lower limit of your package version constraints + Bump(bump::BumpArgs), + + /// Check that platform requirements are satisfied + #[command(name = "check-platform-reqs")] + CheckPlatformReqs(check_platform_reqs::CheckPlatformReqsArgs), + + /// Clears Composer's internal package cache + #[command(name = "clear-cache", alias = "clearcache", alias = "cc")] + ClearCache(clear_cache::ClearCacheArgs), + + /// Sets config options + Config(config::ConfigArgs), + + /// Creates new project from a package into given directory + #[command(name = "create-project")] + CreateProject(create_project::CreateProjectArgs), + + /// Shows which packages cause the given package to be installed + #[command(alias = "why")] + Depends(depends::DependsArgs), + + /// Diagnoses the system to identify common errors + Diagnose(diagnose::DiagnoseArgs), + + /// Dumps the autoloader + #[command(name = "dump-autoload", alias = "dumpautoload")] + DumpAutoload(dump_autoload::DumpAutoloadArgs), + + /// Executes a vendored binary/script + Exec(exec::ExecArgs), + + /// Discover how to help fund the maintenance of your dependencies + Fund(fund::FundArgs), + + /// Allows running commands in the global Composer dir + Global(global::GlobalArgs), + + /// Creates a basic composer.json file in current directory + Init(init::InitArgs), + + /// Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json + #[command(alias = "i")] + Install(install::InstallArgs), + + /// Shows information about licenses of dependencies + Licenses(licenses::LicensesArgs), + + /// Shows a list of installed packages that have updates available + Outdated(outdated::OutdatedArgs), + + /// Shows which packages prevent the given package from being installed + #[command(alias = "why-not")] + Prohibits(prohibits::ProhibitsArgs), + + /// Uninstalls and reinstalls the given package names + Reinstall(reinstall::ReinstallArgs), + + /// Removes a package from the require or require-dev + #[command(alias = "rm", alias = "uninstall")] + Remove(remove::RemoveArgs), + + /// Manage repositories + #[command(alias = "repo")] + Repository(repository::RepositoryArgs), + + /// Adds required packages to your composer.json and installs them + #[command(alias = "r")] + Require(require::RequireArgs), + + /// Runs the scripts defined in composer.json + #[command(name = "run-script", alias = "run")] + RunScript(run_script::RunScriptArgs), + + /// Searches for packages + Search(search::SearchArgs), + + /// Updates Composer to the latest version + #[command(name = "self-update", alias = "selfupdate")] + SelfUpdate(self_update::SelfUpdateArgs), + + /// Shows information about packages + #[command(alias = "info")] + Show(show::ShowArgs), + + /// Shows a list of locally modified packages + Status(status::StatusArgs), + + /// Shows package suggestions + Suggests(suggests::SuggestsArgs), + + /// Updates your dependencies to the latest version according to composer.json + #[command(alias = "u", alias = "upgrade")] + Update(update::UpdateArgs), + + /// Validates a composer.json and composer.lock + Validate(validate::ValidateArgs), +} + +pub fn execute(command: &Commands) { + match command { + Commands::About(args) => about::execute(args), + Commands::Archive(args) => archive::execute(args), + Commands::Audit(args) => audit::execute(args), + Commands::Browse(args) => browse::execute(args), + Commands::Bump(args) => bump::execute(args), + Commands::CheckPlatformReqs(args) => check_platform_reqs::execute(args), + Commands::ClearCache(args) => clear_cache::execute(args), + Commands::Config(args) => config::execute(args), + Commands::CreateProject(args) => create_project::execute(args), + Commands::Depends(args) => depends::execute(args), + Commands::Diagnose(args) => diagnose::execute(args), + Commands::DumpAutoload(args) => dump_autoload::execute(args), + Commands::Exec(args) => exec::execute(args), + Commands::Fund(args) => fund::execute(args), + Commands::Global(args) => global::execute(args), + Commands::Init(args) => init::execute(args), + Commands::Install(args) => install::execute(args), + Commands::Licenses(args) => licenses::execute(args), + Commands::Outdated(args) => outdated::execute(args), + Commands::Prohibits(args) => prohibits::execute(args), + Commands::Reinstall(args) => reinstall::execute(args), + Commands::Remove(args) => remove::execute(args), + Commands::Repository(args) => repository::execute(args), + Commands::Require(args) => require::execute(args), + Commands::RunScript(args) => run_script::execute(args), + Commands::Search(args) => search::execute(args), + Commands::SelfUpdate(args) => self_update::execute(args), + Commands::Show(args) => show::execute(args), + Commands::Status(args) => status::execute(args), + Commands::Suggests(args) => suggests::execute(args), + Commands::Update(args) => update::execute(args), + Commands::Validate(args) => validate::execute(args), + } +} diff --git a/crates/mozart/src/commands/about.rs b/crates/mozart/src/commands/about.rs new file mode 100644 index 0000000..833b6c8 --- /dev/null +++ b/crates/mozart/src/commands/about.rs @@ -0,0 +1,8 @@ +use clap::Args; + +#[derive(Args)] +pub struct AboutArgs {} + +pub fn execute(_args: &AboutArgs) { + todo!() +} diff --git a/crates/mozart/src/commands/archive.rs b/crates/mozart/src/commands/archive.rs new file mode 100644 index 0000000..1fbef6c --- /dev/null +++ b/crates/mozart/src/commands/archive.rs @@ -0,0 +1,30 @@ +use clap::Args; + +#[derive(Args)] +pub struct ArchiveArgs { + /// The package name + pub package: Option<String>, + + /// A version constraint + pub version: Option<String>, + + /// Format of the resulting archive (tar, tar.gz, tar.bz2, zip) + #[arg(short, long)] + pub format: Option<String>, + + /// Write the archive to this directory + #[arg(long)] + pub dir: Option<String>, + + /// Write the archive with the given file name + #[arg(long)] + pub file: Option<String>, + + /// Ignore filters when saving archive + #[arg(long)] + pub ignore_filters: bool, +} + +pub fn execute(_args: &ArchiveArgs) { + todo!() +} diff --git a/crates/mozart/src/commands/audit.rs b/crates/mozart/src/commands/audit.rs new file mode 100644 index 0000000..02b0d8d --- /dev/null +++ b/crates/mozart/src/commands/audit.rs @@ -0,0 +1,32 @@ +use clap::Args; + +#[derive(Args)] +pub struct AuditArgs { + /// Disables installation of require-dev packages + #[arg(long)] + pub no_dev: bool, + + /// Output format (table, plain, json, summary) + #[arg(short, long, default_value = "table")] + pub format: String, + + /// Audit packages from the lock file + #[arg(long)] + pub locked: bool, + + /// Handling of abandoned packages (ignore, report, fail) + #[arg(long)] + pub abandoned: Option<String>, + + /// Ignore advisories of a given severity (low, medium, high, critical) + #[arg(long)] + pub ignore_severity: Vec<String>, + + /// Ignore advisories from sources that are unreachable + #[arg(long)] + pub ignore_unreachable: bool, +} + +pub fn execute(_args: &AuditArgs) { + todo!() +} diff --git a/crates/mozart/src/commands/browse.rs b/crates/mozart/src/commands/browse.rs new file mode 100644 index 0000000..b6cb08f --- /dev/null +++ b/crates/mozart/src/commands/browse.rs @@ -0,0 +1,19 @@ +use clap::Args; + +#[derive(Args)] +pub struct BrowseArgs { + /// Package(s) to browse + pub packages: Vec<String>, + + /// Open the homepage instead of the repository URL + #[arg(short = 'H', long)] + pub homepage: bool, + + /// Only show the homepage or repository URL + #[arg(short, long)] + pub show: bool, +} + +pub fn execute(_args: &BrowseArgs) { + todo!() +} diff --git a/crates/mozart/src/commands/bump.rs b/crates/mozart/src/commands/bump.rs new file mode 100644 index 0000000..40e01f1 --- /dev/null +++ b/crates/mozart/src/commands/bump.rs @@ -0,0 +1,23 @@ +use clap::Args; + +#[derive(Args)] +pub struct BumpArgs { + /// Package(s) to bump + pub packages: Vec<String>, + + /// Only bump packages in require-dev + #[arg(short = 'D', long)] + pub dev_only: bool, + + /// Only bump packages in require + #[arg(short = 'R', long)] + pub no_dev_only: bool, + + /// Only output what would be changed, do not modify files + #[arg(long)] + pub dry_run: bool, +} + +pub fn execute(_args: &BumpArgs) { + todo!() +} diff --git a/crates/mozart/src/commands/check_platform_reqs.rs b/crates/mozart/src/commands/check_platform_reqs.rs new file mode 100644 index 0000000..697b3f6 --- /dev/null +++ b/crates/mozart/src/commands/check_platform_reqs.rs @@ -0,0 +1,20 @@ +use clap::Args; + +#[derive(Args)] +pub struct CheckPlatformReqsArgs { + /// Disables checking of require-dev packages requirements + #[arg(long)] + pub no_dev: bool, + + /// Check packages from the lock file + #[arg(long)] + pub lock: bool, + + /// Output format (text, json) + #[arg(short, long)] + pub format: Option<String>, +} + +pub fn execute(_args: &CheckPlatformReqsArgs) { + todo!() +} diff --git a/crates/mozart/src/commands/clear_cache.rs b/crates/mozart/src/commands/clear_cache.rs new file mode 100644 index 0000000..051ff4c --- /dev/null +++ b/crates/mozart/src/commands/clear_cache.rs @@ -0,0 +1,12 @@ +use clap::Args; + +#[derive(Args)] +pub struct ClearCacheArgs { + /// Only run garbage collection, not a full cache clear + #[arg(long)] + pub gc: bool, +} + +pub fn execute(_args: &ClearCacheArgs) { + todo!() +} diff --git a/crates/mozart/src/commands/config.rs b/crates/mozart/src/commands/config.rs new file mode 100644 index 0000000..4434840 --- /dev/null +++ b/crates/mozart/src/commands/config.rs @@ -0,0 +1,58 @@ +use clap::Args; + +#[derive(Args)] +pub struct ConfigArgs { + /// Setting key + pub setting_key: Option<String>, + + /// Setting value(s) + pub setting_value: Vec<String>, + + /// Apply to the global config file + #[arg(short, long)] + pub global: bool, + + /// Open the config file in an editor + #[arg(short, long)] + pub editor: bool, + + /// Affect auth config file + #[arg(short, long)] + pub auth: bool, + + /// Unset the given setting key + #[arg(long)] + pub unset: bool, + + /// List the current configuration variables + #[arg(short, long)] + pub list: bool, + + /// Use a specific config file + #[arg(short, long)] + pub file: Option<String>, + + /// Returns absolute paths when fetching *-dir config values + #[arg(long)] + pub absolute: bool, + + /// JSON decode the setting value + #[arg(short, long)] + pub json: bool, + + /// Merge the setting value with the current value + #[arg(short, long)] + pub merge: bool, + + /// Append to existing array values + #[arg(long)] + pub append: bool, + + /// Display the origin of a config setting + #[arg(long)] + pub source: bool, +} + +pub fn execute(_args: &ConfigArgs) { + todo!() +} diff --git a/crates/mozart/src/commands/create_project.rs b/crates/mozart/src/commands/create_project.rs new file mode 100644 index 0000000..814d33b --- /dev/null +++ b/crates/mozart/src/commands/create_project.rs @@ -0,0 +1,105 @@ +use clap::Args; + +#[derive(Args)] +pub struct CreateProjectArgs { + /// Package name to install + pub package: Option<String>, + + /// Directory to create the project in + pub directory: Option<String>, + + /// Version constraint + pub version: Option<String>, + + /// Minimum stability (stable, RC, beta, alpha, dev) + #[arg(short, long)] + pub stability: Option<String>, + + /// Forces installation from package sources when possible + #[arg(long)] + pub prefer_source: bool, + + /// Forces installation from package dist + #[arg(long)] + pub prefer_dist: bool, + + /// Forces usage of a specific install method (dist, source, auto) + #[arg(long)] + pub prefer_install: Option<String>, + + /// Add a custom repository to discover the package + #[arg(long)] + pub repository: Vec<String>, + + /// [Deprecated] Use --repository instead + #[arg(long)] + pub repository_url: Option<String>, + + /// Add the repository to the composer.json + #[arg(long)] + pub add_repository: bool, + + /// Install require-dev packages + #[arg(long)] + pub dev: bool, + + /// Disables installation of require-dev packages + #[arg(long)] + pub no_dev: bool, + + /// [Deprecated] Use --no-plugins instead + #[arg(long)] + pub no_custom_installers: bool, + + /// Skips execution of scripts defined in composer.json + #[arg(long)] + pub no_scripts: bool, + + /// Do not output download progress + #[arg(long)] + pub no_progress: bool, + + /// Disable HTTPS and allow HTTP + #[arg(long)] + pub no_secure_http: bool, + + /// Keep the VCS metadata + #[arg(long)] + pub keep_vcs: bool, + + /// Force removal of the VCS metadata + #[arg(long)] + pub remove_vcs: bool, + + /// Skip the install step after project creation + #[arg(long)] + pub no_install: bool, + + /// Skip the audit step after installation + #[arg(long)] + pub no_audit: bool, + + /// Audit output format + #[arg(long)] + pub audit_format: Option<String>, + + /// Do not block on security advisories + #[arg(long)] + pub no_security_blocking: bool, + + /// Ignore a specific platform requirement + #[arg(long)] + pub ignore_platform_req: Vec<String>, + + /// Ignore all platform requirements + #[arg(long)] + pub ignore_platform_reqs: bool, + + /// Interactive package resolution + #[arg(long)] + pub ask: bool, +} + +pub fn execute(_args: &CreateProjectArgs) { + todo!() +} diff --git a/crates/mozart/src/commands/depends.rs b/crates/mozart/src/commands/depends.rs new file mode 100644 index 0000000..33aabc6 --- /dev/null +++ b/crates/mozart/src/commands/depends.rs @@ -0,0 +1,23 @@ +use clap::Args; + +#[derive(Args)] +pub struct DependsArgs { + /// Package to inspect + pub package: String, + + /// Recursively resolve up to the root package + #[arg(short, long)] + pub recursive: bool, + + /// Prints the results as a nested tree + #[arg(short, long)] + pub tree: bool, + + /// Read dependency information from the lock file + #[arg(long)] + pub locked: bool, +} + +pub fn execute(_args: &DependsArgs) { + todo!() +} diff --git a/crates/mozart/src/commands/diagnose.rs b/crates/mozart/src/commands/diagnose.rs new file mode 100644 index 0000000..5a77ba5 --- /dev/null +++ b/crates/mozart/src/commands/diagnose.rs @@ -0,0 +1,8 @@ +use clap::Args; + +#[derive(Args)] +pub struct DiagnoseArgs {} + +pub fn execute(_args: &DiagnoseArgs) { + todo!() +} diff --git a/crates/mozart/src/commands/dump_autoload.rs b/crates/mozart/src/commands/dump_autoload.rs new file mode 100644 index 0000000..0eb20c9 --- /dev/null +++ b/crates/mozart/src/commands/dump_autoload.rs @@ -0,0 +1,52 @@ +use clap::Args; + +#[derive(Args)] +pub struct DumpAutoloadArgs { + /// Optimizes PSR-0 and PSR-4 packages to be loaded with classmaps + #[arg(short, long)] + pub optimize: bool, + + /// Autoload classes from the classmap only + #[arg(short = 'a', long)] + pub classmap_authoritative: bool, + + /// Use APCu to cache found/not-found classes + #[arg(long)] + pub apcu: bool, + + /// Use a custom prefix for the APCu autoloader cache + #[arg(long)] + pub apcu_prefix: Option<String>, + + /// Only output what would be changed, do not modify files + #[arg(long)] + pub dry_run: bool, + + /// Enables autoload-dev rules + #[arg(long)] + pub dev: bool, + + /// Disables autoload-dev rules + #[arg(long)] + pub no_dev: bool, + + /// Ignore a specific platform requirement + #[arg(long)] + pub ignore_platform_req: Vec<String>, + + /// Ignore all platform requirements + #[arg(long)] + pub ignore_platform_reqs: bool, + + /// Return a failed status code if there are PSR mapping errors + #[arg(long)] + pub strict_psr: bool, + + /// Return a failed status code if there are ambiguous class mappings + #[arg(long)] + pub strict_ambiguous: bool, +} + +pub fn execute(_args: &DumpAutoloadArgs) { + todo!() +} diff --git a/crates/mozart/src/commands/exec.rs b/crates/mozart/src/commands/exec.rs new file mode 100644 index 0000000..7635058 --- /dev/null +++ b/crates/mozart/src/commands/exec.rs @@ -0,0 +1,19 @@ +use clap::Args; + +#[derive(Args)] +pub struct ExecArgs { + /// The binary to run + pub binary: Option<String>, + + /// Arguments to pass to the binary + #[arg(trailing_var_arg = true)] + pub args: Vec<String>, + + /// List the available binaries + #[arg(short, long)] + pub list: bool, +} + +pub fn execute(_args: &ExecArgs) { + todo!() +} diff --git a/crates/mozart/src/commands/fund.rs b/crates/mozart/src/commands/fund.rs new file mode 100644 index 0000000..bd82306 --- /dev/null +++ b/crates/mozart/src/commands/fund.rs @@ -0,0 +1,12 @@ +use clap::Args; + +#[derive(Args)] +pub struct FundArgs { + /// Output format (text, json) + #[arg(short, long)] + pub format: Option<String>, +} + +pub fn execute(_args: &FundArgs) { + todo!() +} diff --git a/crates/mozart/src/commands/global.rs b/crates/mozart/src/commands/global.rs new file mode 100644 index 0000000..c4de5e4 --- /dev/null +++ b/crates/mozart/src/commands/global.rs @@ -0,0 +1,15 @@ +use clap::Args; + +#[derive(Args)] +pub struct GlobalArgs { + /// The command name to run + pub command_name: String, + + /// Arguments to pass to the command + #[arg(trailing_var_arg = true)] + pub args: Vec<String>, +} + +pub fn execute(_args: &GlobalArgs) { + todo!() +} diff --git a/crates/mozart/src/commands/init.rs b/crates/mozart/src/commands/init.rs new file mode 100644 index 0000000..059e494 --- /dev/null +++ b/crates/mozart/src/commands/init.rs @@ -0,0 +1,52 @@ +use clap::Args; + +#[derive(Args)] +pub struct InitArgs { + /// Name of the package (vendor/name) + #[arg(long)] + pub name: Option<String>, + + /// Description of the package + #[arg(long)] + pub description: Option<String>, + + /// Author name of the package + #[arg(long)] + pub author: Option<String>, + + /// Type of the package + #[arg(long, value_name = "TYPE")] + pub r#type: Option<String>, + + /// Homepage of the package + #[arg(long)] + pub homepage: Option<String>, + + /// Package(s) to require + #[arg(long)] + pub require: Vec<String>, + + /// Package(s) to require for development + #[arg(long)] + pub require_dev: Vec<String>, + + /// Minimum stability (stable, RC, beta, alpha, dev) + #[arg(short, long)] + pub stability: Option<String>, + + /// License of the package + #[arg(short, long)] + pub license: Option<String>, + + /// Add a custom repository + #[arg(long)] + pub repository: Vec<String>, + + /// Define a PSR-4 autoload namespace + #[arg(short, long)] + pub autoload: Option<String>, +} + +pub fn execute(_args: &InitArgs) { + todo!() +} diff --git a/crates/mozart/src/commands/install.rs b/crates/mozart/src/commands/install.rs new file mode 100644 index 0000000..e839e96 --- /dev/null +++ b/crates/mozart/src/commands/install.rs @@ -0,0 +1,91 @@ +use clap::Args; + +#[derive(Args)] +pub struct InstallArgs { + /// Package(s) to install + pub packages: Vec<String>, + + /// Forces installation from package sources when possible + #[arg(long)] + pub prefer_source: bool, + + /// Forces installation from package dist + #[arg(long)] + pub prefer_dist: bool, + + /// Forces usage of a specific install method (dist, source, auto) + #[arg(long)] + pub prefer_install: Option<String>, + + /// Only output what would be changed, do not modify files + #[arg(long)] + pub dry_run: bool, + + /// Only download packages, do not install + #[arg(long)] + pub download_only: bool, + + /// [Deprecated] Enables installation of require-dev packages + #[arg(long)] + pub dev: bool, + + /// Disables installation of require-dev packages + #[arg(long)] + pub no_dev: bool, + + /// Do not block on security advisories + #[arg(long)] + pub no_security_blocking: bool, + + /// Skips autoloader generation + #[arg(long)] + pub no_autoloader: bool, + + /// Do not output download progress + #[arg(long)] + pub no_progress: bool, + + /// Skip the install step + #[arg(long)] + pub no_install: bool, + + /// [Deprecated] Do not show install suggestions + #[arg(long)] + pub no_suggest: bool, + + /// Run audit after installation + #[arg(long)] + pub audit: bool, + + /// Audit output format + #[arg(long)] + pub audit_format: Option<String>, + + /// Optimizes PSR-0 and PSR-4 packages to be loaded with classmaps + #[arg(short, long)] + pub optimize_autoloader: bool, + + /// Autoload classes from the classmap only + #[arg(short = 'a', long)] + pub classmap_authoritative: bool, + + /// Use APCu to cache found/not-found classes + #[arg(long)] + pub apcu_autoloader: bool, + + /// Use a custom prefix for the APCu autoloader cache + #[arg(long)] + pub apcu_autoloader_prefix: Option<String>, + + /// Ignore a specific platform requirement + #[arg(long)] + pub ignore_platform_req: Vec<String>, + + /// Ignore all platform requirements + #[arg(long)] + pub ignore_platform_reqs: bool, +} + +pub fn execute(_args: &InstallArgs) { + todo!() +} diff --git a/crates/mozart/src/commands/licenses.rs b/crates/mozart/src/commands/licenses.rs new file mode 100644 index 0000000..d9b0caf --- /dev/null +++ b/crates/mozart/src/commands/licenses.rs @@ -0,0 +1,20 @@ +use clap::Args; + +#[derive(Args)] +pub struct LicensesArgs { + /// Output format (text, json, summary) + #[arg(short, long)] + pub format: Option<String>, + + /// Disables listing of require-dev packages + #[arg(long)] + pub no_dev: bool, + + /// List packages from the lock file + #[arg(long)] + pub locked: bool, +} + +pub fn execute(_args: &LicensesArgs) { + todo!() +} diff --git a/crates/mozart/src/commands/outdated.rs b/crates/mozart/src/commands/outdated.rs new file mode 100644 index 0000000..3bbb451 --- /dev/null +++ b/crates/mozart/src/commands/outdated.rs @@ -0,0 +1,67 @@ +use clap::Args; + +#[derive(Args)] +pub struct OutdatedArgs { + /// Package to inspect + pub package: Option<String>, + + /// Show only packages that are outdated + #[arg(short, long)] + pub outdated: bool, + + /// Show all installed packages + #[arg(short, long)] + pub all: bool, + + /// Show packages from the lock file + #[arg(long)] + pub locked: bool, + + /// Shows only packages that are directly required by the root package + #[arg(short = 'D', long)] + pub direct: bool, + + /// Return a non-zero exit code when there are outdated packages + #[arg(long)] + pub strict: bool, + + /// Only show packages that have major SemVer-compatible updates + #[arg(short = 'M', long)] + pub major_only: bool, + + /// Only show packages that have minor SemVer-compatible updates + #[arg(short = 'm', long)] + pub minor_only: bool, + + /// Only show packages that have patch SemVer-compatible updates + #[arg(short = 'p', long)] + pub patch_only: bool, + + /// Sort packages by age of the last update + #[arg(short = 'A', long)] + pub sort_by_age: bool, + + /// Output format (text, json) + #[arg(short, long)] + pub format: Option<String>, + + /// Ignore specified package(s) + #[arg(long)] + pub ignore: Vec<String>, + + /// Disables listing of require-dev packages + #[arg(long)] + pub no_dev: bool, + + /// Ignore a specific platform requirement + #[arg(long)] + pub ignore_platform_req: Vec<String>, + + /// Ignore all platform requirements + #[arg(long)] + pub ignore_platform_reqs: bool, +} + +pub fn execute(_args: &OutdatedArgs) { + todo!() +} diff --git a/crates/mozart/src/commands/prohibits.rs b/crates/mozart/src/commands/prohibits.rs new file mode 100644 index 0000000..aff1ee0 --- /dev/null +++ b/crates/mozart/src/commands/prohibits.rs @@ -0,0 +1,26 @@ +use clap::Args; + +#[derive(Args)] +pub struct ProhibitsArgs { + /// Package to inspect + pub package: String, + + /// Version constraint + pub version: String, + + /// Recursively resolve up to the root package + #[arg(short, long)] + pub recursive: bool, + + /// Prints the results as a nested tree + #[arg(short, long)] + pub tree: bool, + + /// Read dependency information from the lock file + #[arg(long)] + pub locked: bool, +} + +pub fn execute(_args: &ProhibitsArgs) { + todo!() +} diff --git a/crates/mozart/src/commands/reinstall.rs b/crates/mozart/src/commands/reinstall.rs new file mode 100644 index 0000000..08aad44 --- /dev/null +++ b/crates/mozart/src/commands/reinstall.rs @@ -0,0 +1,59 @@ +use clap::Args; + +#[derive(Args)] +pub struct ReinstallArgs { + /// Package(s) to reinstall + pub packages: Vec<String>, + + /// Forces installation from package sources when possible + #[arg(long)] + pub prefer_source: bool, + + /// Forces installation from package dist + #[arg(long)] + pub prefer_dist: bool, + + /// Forces usage of a specific install method (dist, source, auto) + #[arg(long)] + pub prefer_install: Option<String>, + + /// Skips autoloader generation + #[arg(long)] + pub no_autoloader: bool, + + /// Do not output download progress + #[arg(long)] + pub no_progress: bool, + + /// Optimizes PSR-0 and PSR-4 packages to be loaded with classmaps + #[arg(short, long)] + pub optimize_autoloader: bool, + + /// Autoload classes from the classmap only + #[arg(short = 'a', long)] + pub classmap_authoritative: bool, + + /// Use APCu to cache found/not-found classes + #[arg(long)] + pub apcu_autoloader: bool, + + /// Use a custom prefix for the APCu autoloader cache + #[arg(long)] + pub apcu_autoloader_prefix: Option<String>, + + /// Ignore a specific platform requirement + #[arg(long)] + pub ignore_platform_req: Vec<String>, + + /// Ignore all platform requirements + #[arg(long)] + pub ignore_platform_reqs: bool, + + /// Filter packages to reinstall by type + #[arg(long, value_name = "TYPE")] + pub r#type: Vec<String>, +} + +pub fn execute(_args: &ReinstallArgs) { + todo!() +} diff --git a/crates/mozart/src/commands/remove.rs b/crates/mozart/src/commands/remove.rs new file mode 100644 index 0000000..b444a66 --- /dev/null +++ b/crates/mozart/src/commands/remove.rs @@ -0,0 +1,95 @@ +use clap::Args; + +#[derive(Args)] +pub struct RemoveArgs { + /// Package(s) to remove + pub packages: Vec<String>, + + /// Remove from require-dev + #[arg(long)] + pub dev: bool, + + /// Only output what would be changed, do not modify files + #[arg(long)] + pub dry_run: bool, + + /// Do not output download progress + #[arg(long)] + pub no_progress: bool, + + /// Disables the automatic update of the lock file + #[arg(long)] + pub no_update: bool, + + /// Skip the install step + #[arg(long)] + pub no_install: bool, + + /// Skip the audit step + #[arg(long)] + pub no_audit: bool, + + /// Audit output format + #[arg(long)] + pub audit_format: Option<String>, + + /// Do not block on security advisories + #[arg(long)] + pub no_security_blocking: bool, + + /// Run the dependency update with the --no-dev option + #[arg(long)] + pub update_no_dev: bool, + + /// [Deprecated] Use --with-all-dependencies instead + #[arg(short = 'w', long)] + pub update_with_dependencies: bool, + + /// [Deprecated] Use --with-all-dependencies instead + #[arg(short = 'W', long)] + pub update_with_all_dependencies: bool, + + /// Update also dependencies of the removed packages + #[arg(long)] + pub with_all_dependencies: bool, + + /// Skip updating dependencies + #[arg(long)] + pub no_update_with_dependencies: bool, + + /// Prefer minimal restriction updates + #[arg(short = 'm', long)] + pub minimal_changes: bool, + + /// Remove unused packages + #[arg(long)] + pub unused: bool, + + /// Ignore a specific platform requirement + #[arg(long)] + pub ignore_platform_req: Vec<String>, + + /// Ignore all platform requirements + #[arg(long)] + pub ignore_platform_reqs: bool, + + /// Optimizes PSR-0 and PSR-4 packages to be loaded with classmaps + #[arg(short, long)] + pub optimize_autoloader: bool, + + /// Autoload classes from the classmap only + #[arg(short = 'a', long)] + pub classmap_authoritative: bool, + + /// Use APCu to cache found/not-found classes + #[arg(long)] + pub apcu_autoloader: bool, + + /// Use a custom prefix for the APCu autoloader cache + #[arg(long)] + pub apcu_autoloader_prefix: Option<String>, +} + +pub fn execute(_args: &RemoveArgs) { + todo!() +} diff --git a/crates/mozart/src/commands/repository.rs b/crates/mozart/src/commands/repository.rs new file mode 100644 index 0000000..8646c06 --- /dev/null +++ b/crates/mozart/src/commands/repository.rs @@ -0,0 +1,40 @@ +use clap::Args; + +#[derive(Args)] +pub struct RepositoryArgs { + /// Action (list, add, remove, set-url, get-url, enable, disable) + pub action: Option<String>, + + /// Repository name + pub name: Option<String>, + + /// Argument 1 (URL or type depending on action) + pub arg1: Option<String>, + + /// Argument 2 + pub arg2: Option<String>, + + /// Apply to the global config file + #[arg(short, long)] + pub global: bool, + + /// Use a specific config file + #[arg(short, long)] + pub file: Option<String>, + + /// Append the repository instead of prepending it + #[arg(long)] + pub append: bool, + + /// Add before a specific repository + #[arg(long)] + pub before: Option<String>, + + /// Add after a specific repository + #[arg(long)] + pub after: Option<String>, +} + +pub fn execute(_args: &RepositoryArgs) { + todo!() +} diff --git a/crates/mozart/src/commands/require.rs b/crates/mozart/src/commands/require.rs new file mode 100644 index 0000000..3b8cceb --- /dev/null +++ b/crates/mozart/src/commands/require.rs @@ -0,0 +1,123 @@ +use clap::Args; + +#[derive(Args)] +pub struct RequireArgs { + /// Package(s) to require + pub packages: Vec<String>, + + /// Add requirement to require-dev + #[arg(long)] + pub dev: bool, + + /// Only output what would be changed, do not modify files + #[arg(long)] + pub dry_run: bool, + + /// Forces installation from package sources when possible + #[arg(long)] + pub prefer_source: bool, + + /// Forces installation from package dist + #[arg(long)] + pub prefer_dist: bool, + + /// Forces usage of a specific install method (dist, source, auto) + #[arg(long)] + pub prefer_install: Option<String>, + + /// Pin the exact version instead of a range + #[arg(long)] + pub fixed: bool, + + /// [Deprecated] Do not show install suggestions + #[arg(long)] + pub no_suggest: bool, + + /// Do not output download progress + #[arg(long)] + pub no_progress: bool, + + /// Disables the automatic update of the lock file + #[arg(long)] + pub no_update: bool, + + /// Skip the install step + #[arg(long)] + pub no_install: bool, + + /// Skip the audit step + #[arg(long)] + pub no_audit: bool, + + /// Audit output format + #[arg(long)] + pub audit_format: Option<String>, + + /// Do not block on security advisories + #[arg(long)] + pub no_security_blocking: bool, + + /// Run the dependency update with the --no-dev option + #[arg(long)] + pub update_no_dev: bool, + + /// [Deprecated] Use --with-dependencies instead + #[arg(short = 'w', long)] + pub update_with_dependencies: bool, + + /// [Deprecated] Use --with-all-dependencies instead + #[arg(short = 'W', long)] + pub update_with_all_dependencies: bool, + + /// Update also dependencies of newly required packages + #[arg(long)] + pub with_dependencies: bool, + + /// Update all dependencies including root requirements + #[arg(long)] + pub with_all_dependencies: bool, + + /// Ignore a specific platform requirement + #[arg(long)] + pub ignore_platform_req: Vec<String>, + + /// Ignore all platform requirements + #[arg(long)] + pub ignore_platform_reqs: bool, + + /// Prefer stable versions of dependencies + #[arg(long)] + pub prefer_stable: bool, + + /// Prefer lowest versions of dependencies + #[arg(long)] + pub prefer_lowest: bool, + + /// Prefer minimal restriction updates + #[arg(short = 'm', long)] + pub minimal_changes: bool, + + /// Sort packages in composer.json + #[arg(long)] + pub sort_packages: bool, + + /// Optimizes PSR-0 and PSR-4 packages to be loaded with classmaps + #[arg(short, long)] + pub optimize_autoloader: bool, + + /// Autoload classes from the classmap only + #[arg(short = 'a', long)] + pub classmap_authoritative: bool, + + /// Use APCu to cache found/not-found classes + #[arg(long)] + pub apcu_autoloader: bool, + + /// Use a custom prefix for the APCu autoloader cache + #[arg(long)] + pub apcu_autoloader_prefix: Option<String>, +} + +pub fn execute(_args: &RequireArgs) { + todo!() +} diff --git a/crates/mozart/src/commands/run_script.rs b/crates/mozart/src/commands/run_script.rs new file mode 100644 index 0000000..e2349a2 --- /dev/null +++ b/crates/mozart/src/commands/run_script.rs @@ -0,0 +1,31 @@ +use clap::Args; + +#[derive(Args)] +pub struct RunScriptArgs { + /// Script name to run + pub script: Option<String>, + + /// Arguments to pass to the script + #[arg(trailing_var_arg = true)] + pub args: Vec<String>, + + /// Set the script timeout in seconds + #[arg(long)] + pub timeout: Option<u64>, + + /// Sets the dev mode + #[arg(long)] + pub dev: bool, + + /// Disables the dev mode + #[arg(long)] + pub no_dev: bool, + + /// List the available scripts + #[arg(short, long)] + pub list: bool, +} + +pub fn execute(_args: &RunScriptArgs) { + todo!() +} diff --git a/crates/mozart/src/commands/search.rs b/crates/mozart/src/commands/search.rs new file mode 100644 index 0000000..3d2d20f --- /dev/null +++ b/crates/mozart/src/commands/search.rs @@ -0,0 +1,28 @@ +use clap::Args; + +#[derive(Args)] +pub struct SearchArgs { + /// Search tokens + #[arg(required = true)] + pub tokens: Vec<String>, + + /// Search only in name + #[arg(short = 'N', long)] + pub only_name: bool, + + /// Search only for vendor / organization + #[arg(short = 'O', long)] + pub only_vendor: bool, + + /// Filter by package type + #[arg(short, long, value_name = "TYPE")] + pub r#type: Option<String>, + + /// Output format (text, json) + #[arg(short, long)] + pub format: Option<String>, +} + +pub fn execute(_args: &SearchArgs) { + todo!() +} diff --git a/crates/mozart/src/commands/self_update.rs b/crates/mozart/src/commands/self_update.rs new file mode 100644 index 0000000..3497d7d --- /dev/null +++ b/crates/mozart/src/commands/self_update.rs @@ -0,0 +1,55 @@ +use clap::Args; + +#[derive(Args)] +pub struct SelfUpdateArgs { + /// Version to update to + pub version: Option<String>, + + /// Revert to a previous version + #[arg(short, long)] + pub rollback: bool, + + /// Delete old backups during self-update + #[arg(long)] + pub clean_backups: bool, + + /// Do not output download progress + #[arg(long)] + pub no_progress: bool, + + /// Prompt user for a key update + #[arg(long)] + pub update_keys: bool, + + /// Force update to the stable channel + #[arg(long)] + pub stable: bool, + + /// Force update to the preview channel + #[arg(long)] + pub preview: bool, + + /// Force update to the snapshot channel + #[arg(long)] + pub snapshot: bool, + + /// Force update to the 1.x channel + #[arg(long = "1")] + pub channel_1: bool, + + /// Force update to the 2.x channel + #[arg(long = "2")] + pub channel_2: bool, + + /// Force update to the 2.2.x LTS channel + #[arg(long = "2.2")] + pub channel_2_2: bool, + + /// Only store the channel as default and skip the update + #[arg(long)] + pub set_channel_only: bool, +} + +pub fn execute(_args: &SelfUpdateArgs) { + todo!() +} diff --git a/crates/mozart/src/commands/show.rs b/crates/mozart/src/commands/show.rs new file mode 100644 index 0000000..290a8dd --- /dev/null +++ b/crates/mozart/src/commands/show.rs @@ -0,0 +1,102 @@ +use clap::Args; + +#[derive(Args)] +pub struct ShowArgs { + /// Package to inspect + pub package: Option<String>, + + /// Version constraint + pub version: Option<String>, + + /// List all packages + #[arg(long)] + pub all: bool, + + /// List packages from the lock file + #[arg(long)] + pub locked: bool, + + /// Show only installed packages (enabled by default) + #[arg(short, long)] + pub installed: bool, + + /// List platform packages only + #[arg(short, long)] + pub platform: bool, + + /// List available packages only + #[arg(short = 'a', long)] + pub available: bool, + + /// Show information about the root package + #[arg(short, long, name = "self")] + pub self_info: bool, + + /// Show package names only + #[arg(short = 'N', long)] + pub name_only: bool, + + /// Show package paths only + #[arg(short = 'P', long)] + pub path: bool, + + /// List the dependencies as a tree + #[arg(short, long)] + pub tree: bool, + + /// Show the latest version + #[arg(short, long)] + pub latest: bool, + + /// Show only packages that are outdated + #[arg(short, long)] + pub outdated: bool, + + /// Ignore specified package(s) + #[arg(long)] + pub ignore: Vec<String>, + + /// Only show packages that have major SemVer-compatible updates + #[arg(short = 'M', long)] + pub major_only: bool, + + /// Only show packages that have minor SemVer-compatible updates + #[arg(short = 'm', long)] + pub minor_only: bool, + + /// Only show packages that have patch SemVer-compatible updates + #[arg(long)] + pub patch_only: bool, + + /// Sort packages by age of the last update + #[arg(short = 'A', long)] + pub sort_by_age: bool, + + /// Shows only packages that are directly required by the root package + #[arg(short = 'D', long)] + pub direct: bool, + + /// Return a non-zero exit code when there are outdated packages + #[arg(long)] + pub strict: bool, + + /// Output format (text, json) + #[arg(short, long)] + pub format: Option<String>, + + /// Disables listing of require-dev packages + #[arg(long)] + pub no_dev: bool, + + /// Ignore a specific platform requirement + #[arg(long)] + pub ignore_platform_req: Vec<String>, + + /// Ignore all platform requirements + #[arg(long)] + pub ignore_platform_reqs: bool, +} + +pub fn execute(_args: &ShowArgs) { + todo!() +} diff --git a/crates/mozart/src/commands/status.rs b/crates/mozart/src/commands/status.rs new file mode 100644 index 0000000..424f404 --- /dev/null +++ b/crates/mozart/src/commands/status.rs @@ -0,0 +1,8 @@ +use clap::Args; + +#[derive(Args)] +pub struct StatusArgs {} + +pub fn execute(_args: &StatusArgs) { + todo!() +} diff --git a/crates/mozart/src/commands/suggests.rs b/crates/mozart/src/commands/suggests.rs new file mode 100644 index 0000000..6a80501 --- /dev/null +++ b/crates/mozart/src/commands/suggests.rs @@ -0,0 +1,31 @@ +use clap::Args; + +#[derive(Args)] +pub struct SuggestsArgs { + /// Package(s) to list suggestions for + pub packages: Vec<String>, + + /// Group output by package + #[arg(long)] + pub by_package: bool, + + /// Group output by suggestion + #[arg(long)] + pub by_suggestion: bool, + + /// Show suggestions for all packages, not just root + #[arg(short, long)] + pub all: bool, + + /// Show only suggested package names in list format + #[arg(long)] + pub list: bool, + + /// Disables suggestions from require-dev packages + #[arg(long)] + pub no_dev: bool, +} + +pub fn execute(_args: &SuggestsArgs) { + todo!() +} diff --git a/crates/mozart/src/commands/update.rs b/crates/mozart/src/commands/update.rs new file mode 100644 index 0000000..0f1257c --- /dev/null +++ b/crates/mozart/src/commands/update.rs @@ -0,0 +1,131 @@ +use clap::Args; + +#[derive(Args)] +pub struct UpdateArgs { + /// Package(s) to update + pub packages: Vec<String>, + + /// Temporary version constraint overrides + #[arg(long)] + pub with: Vec<String>, + + /// Forces installation from package sources when possible + #[arg(long)] + pub prefer_source: bool, + + /// Forces installation from package dist + #[arg(long)] + pub prefer_dist: bool, + + /// Forces usage of a specific install method (dist, source, auto) + #[arg(long)] + pub prefer_install: Option<String>, + + /// Only output what would be changed, do not modify files + #[arg(long)] + pub dry_run: bool, + + /// [Deprecated] Enables installation of require-dev packages + #[arg(long)] + pub dev: bool, + + /// Disables installation of require-dev packages + #[arg(long)] + pub no_dev: bool, + + /// Only updates the lock file hash + #[arg(long)] + pub lock: bool, + + /// Skip the install step + #[arg(long)] + pub no_install: bool, + + /// Skip the audit step + #[arg(long)] + pub no_audit: bool, + + /// Audit output format + #[arg(long)] + pub audit_format: Option<String>, + + /// Do not block on security advisories + #[arg(long)] + pub no_security_blocking: bool, + + /// Skips autoloader generation + #[arg(long)] + pub no_autoloader: bool, + + /// [Deprecated] Do not show install suggestions + #[arg(long)] + pub no_suggest: bool, + + /// Do not output download progress + #[arg(long)] + pub no_progress: bool, + + /// Update also dependencies of packages in the argument list + #[arg(short = 'w', long)] + pub with_dependencies: bool, + + /// Update also all dependencies including root requirements + #[arg(short = 'W', long)] + pub with_all_dependencies: bool, + + /// Optimizes PSR-0 and PSR-4 packages to be loaded with classmaps + #[arg(short, long)] + pub optimize_autoloader: bool, + + /// Autoload classes from the classmap only + #[arg(short = 'a', long)] + pub classmap_authoritative: bool, + + /// Use APCu to cache found/not-found classes + #[arg(long)] + pub apcu_autoloader: bool, + + /// Use a custom prefix for the APCu autoloader cache + #[arg(long)] + pub apcu_autoloader_prefix: Option<String>, + + /// Ignore a specific platform requirement + #[arg(long)] + pub ignore_platform_req: Vec<String>, + + /// Ignore all platform requirements + #[arg(long)] + pub ignore_platform_reqs: bool, + + /// Prefer stable versions of dependencies + #[arg(long)] + pub prefer_stable: bool, + + /// Prefer lowest versions of dependencies + #[arg(long)] + pub prefer_lowest: bool, + + /// Prefer minimal restriction updates + #[arg(short = 'm', long)] + pub minimal_changes: bool, + + /// Only allow patch version updates + #[arg(long)] + pub patch_only: bool, + + /// Interactive package selection + #[arg(short, long)] + pub interactive: bool, + + /// Only update packages that are root requirements + #[arg(long)] + pub root_reqs: bool, + + /// Bump version constraints after update (dev, no-dev, all) + #[arg(long)] + pub bump_after_update: Option<Option<String>>, +} + +pub fn execute(_args: &UpdateArgs) { + todo!() +} diff --git a/crates/mozart/src/commands/validate.rs b/crates/mozart/src/commands/validate.rs new file mode 100644 index 0000000..b76d479 --- /dev/null +++ b/crates/mozart/src/commands/validate.rs @@ -0,0 +1,39 @@ +use clap::Args; + +#[derive(Args)] +pub struct ValidateArgs { + /// Path to composer.json file + pub file: Option<String>, + + /// Skips checks for non-essential issues + #[arg(long)] + pub no_check_all: bool, + + /// Validates the lock file + #[arg(long)] + pub check_lock: bool, + + /// Skips lock file validation + #[arg(long)] + pub no_check_lock: bool, + + /// Skips publish-related checks + #[arg(long)] + pub no_check_publish: bool, + + /// Skips version constraint checks + #[arg(long)] + pub no_check_version: bool, + + /// Also validate all dependencies + #[arg(short = 'A', long)] + pub with_dependencies: bool, + + /// Return a non-zero exit code on warnings as well as errors + #[arg(long)] + pub strict: bool, +} + +pub fn execute(_args: &ValidateArgs) { + todo!() +} diff --git a/crates/mozart/src/lib.rs b/crates/mozart/src/lib.rs new file mode 100644 index 0000000..82b6da3 --- /dev/null +++ b/crates/mozart/src/lib.rs @@ -0,0 +1 @@ +pub mod commands; diff --git a/crates/mozart/src/main.rs b/crates/mozart/src/main.rs new file mode 100644 index 0000000..289d047 --- /dev/null +++ b/crates/mozart/src/main.rs @@ -0,0 +1,7 @@ +use clap::Parser; +use mozart::commands; + +fn main() { + let cli = commands::Cli::parse(); + commands::execute(&cli.command); +} |
