Skip to content

Commit

Permalink
new: Add proto versions command. (#678)
Browse files Browse the repository at this point in the history
  • Loading branch information
milesj committed Dec 19, 2024
1 parent d162877 commit 6007bf6
Show file tree
Hide file tree
Showing 14 changed files with 265 additions and 226 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,5 @@ jobs:
- run: just build
- run: just build-wasm
- run: cargo run -- --help
- run: cargo run -- list-remote node
- run: cargo run -- list-remote wasm-test
- run: cargo run -- versions node
- run: cargo run -- versions wasm-test
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@

#### 💥 Breaking

- Removed the `proto list` and `proto list-remote` commands, use `proto versions` instead.
- Removed the `--global` option from `proto alias`, `unalias`, `pin`, and `unpin`, use `--to` or `--from` instead.
- Removed the `--purge` option from `proto clean`, use `proto uninstall` instead.

## Unreleased
#### 🚀 Updates

- Added a `--yes` option to `proto outdated`, that skips confirmation prompts.
- Added a new command, `proto versions <tool>`, that lists all available remote and installed versions/aliases.

## 0.43.3

Expand Down
31 changes: 12 additions & 19 deletions crates/cli/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use crate::commands::{
debug::{DebugConfigArgs, DebugEnvArgs},
plugin::{AddPluginArgs, InfoPluginArgs, ListPluginsArgs, RemovePluginArgs, SearchPluginArgs},
ActivateArgs, AliasArgs, BinArgs, CleanArgs, CompletionsArgs, DiagnoseArgs, InstallArgs,
ListArgs, ListRemoteArgs, MigrateArgs, OutdatedArgs, PinArgs, RegenArgs, RunArgs, SetupArgs,
StatusArgs, UnaliasArgs, UninstallArgs, UnpinArgs, UpgradeArgs,
MigrateArgs, OutdatedArgs, PinArgs, RegenArgs, RunArgs, SetupArgs, StatusArgs, UnaliasArgs,
UninstallArgs, UnpinArgs, UpgradeArgs, VersionsArgs,
};
use clap::builder::styling::{Color, Style, Styles};
use clap::{Parser, Subcommand, ValueEnum};
Expand Down Expand Up @@ -184,21 +184,6 @@ pub enum Commands {
)]
Install(InstallArgs),

#[command(
alias = "ls",
name = "list",
about = "List installed versions for a tool."
)]
List(ListArgs),

#[command(
alias = "lsr",
name = "list-remote",
about = "List available versions for a tool.",
long_about = "List available versions by resolving versions from the tool's remote release manifest."
)]
ListRemote(ListRemoteArgs),

#[command(
name = "migrate",
about = "Migrate breaking changes for the proto installation."
Expand Down Expand Up @@ -277,6 +262,14 @@ pub enum Commands {
about = "Upgrade proto to the latest version."
)]
Upgrade(UpgradeArgs),

#[command(
alias = "vs",
name = "versions",
about = "List available versions for a tool.",
long_about = "List available versions for a tool by resolving versions from the tool's remote release manifest."
)]
Versions(VersionsArgs),
}

#[derive(Clone, Debug, Subcommand)]
Expand All @@ -296,7 +289,7 @@ pub enum PluginCommands {
#[command(
name = "add",
about = "Add a plugin to manage a tool.",
long_about = "Add a plugin to the local ./.prototools config, or global ~/.proto/.prototools config."
long_about = "Add a plugin to a .prototools config file to enable and manage that tool."
)]
Add(AddPluginArgs),

Expand All @@ -315,7 +308,7 @@ pub enum PluginCommands {
#[command(
name = "remove",
about = "Remove a plugin and unmanage a tool.",
long_about = "Remove a plugin from the local ./.prototools config, or global ~/.proto/.prototools config."
long_about = "Remove a plugin from a .prototools config file and unmanage that tool."
)]
Remove(RemovePluginArgs),

Expand Down
66 changes: 0 additions & 66 deletions crates/cli/src/commands/list.rs

This file was deleted.

63 changes: 0 additions & 63 deletions crates/cli/src/commands/list_remote.rs

This file was deleted.

6 changes: 2 additions & 4 deletions crates/cli/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ mod completions;
pub mod debug;
mod diagnose;
mod install;
mod list;
mod list_remote;
mod migrate;
mod outdated;
mod pin;
Expand All @@ -20,6 +18,7 @@ mod unalias;
mod uninstall;
mod unpin;
mod upgrade;
mod versions;

pub use activate::*;
pub use alias::*;
Expand All @@ -28,8 +27,6 @@ pub use clean::*;
pub use completions::*;
pub use diagnose::*;
pub use install::*;
pub use list::*;
pub use list_remote::*;
pub use migrate::*;
pub use outdated::*;
pub use pin::*;
Expand All @@ -41,3 +38,4 @@ pub use unalias::*;
pub use uninstall::*;
pub use unpin::*;
pub use upgrade::*;
pub use versions::*;
7 changes: 2 additions & 5 deletions crates/cli/src/commands/plugin/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,11 @@ pub async fn add(session: ProtoSession, args: AddPluginArgs) -> AppResult {
// the recent addition!
#[cfg(not(debug_assertions))]
{
use proto_core::load_tool_from_locator;
use starbase_styles::color::apply_style_tags;

let tool = load_tool_from_locator(&args.id, &session.env, &args.plugin).await?;
let tool = proto_core::load_tool_from_locator(&args.id, &session.env, &args.plugin).await?;

if !tool.metadata.deprecations.is_empty() {
session.console.render(element! {
Notice(title: "Deprecations", variant: Variant::Info) {
Notice(title: "Deprecations".to_owned(), variant: Variant::Info) {
List {
#(tool.metadata.deprecations.iter().map(|message| {
element! {
Expand Down
Loading

0 comments on commit 6007bf6

Please sign in to comment.