Skip to content

Commit

Permalink
chore(hok): command description tweaks
Browse files Browse the repository at this point in the history
Signed-off-by: Chawye Hsu <[email protected]>
  • Loading branch information
chawyehsu committed Aug 3, 2023
1 parent ca8fad7 commit ccf6672
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 16 deletions.
20 changes: 10 additions & 10 deletions src/clap_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub fn build() -> Command {
)
.subcommand(
Command::new("cache")
.about("List or remove download caches")
.about("Package cache management")
.arg_required_else_help(true)
.subcommand(
Command::new("list")
Expand Down Expand Up @@ -84,7 +84,7 @@ pub fn build() -> Command {
)
.subcommand(
Command::new("cat")
.about("Display manifest content of a package")
.about("Inspect the manifest of a package")
.arg_required_else_help(true)
.arg(
Arg::new("package")
Expand All @@ -111,7 +111,7 @@ pub fn build() -> Command {
)
.subcommand(
Command::new("config")
.about("Configuration manipulations")
.about("Configuration management")
.arg_required_else_help(true)
.subcommand(
Command::new("edit").about("Edit the config file [default editor: notepad]"),
Expand Down Expand Up @@ -145,7 +145,7 @@ pub fn build() -> Command {
)
.subcommand(
Command::new("hold")
.about("Hold package(s) to disable updates")
.about("Hold package(s) to disable changes")
.arg_required_else_help(true)
.arg(
Arg::new("package")
Expand All @@ -156,17 +156,17 @@ pub fn build() -> Command {
)
.subcommand(
Command::new("home")
.about("Open the homepage of given package")
.about("Browse the homepage of a package")
.arg_required_else_help(true)
.arg(Arg::new("package").help("The package name").required(true)),
)
.subcommand(
Command::new("info")
.about("Display information about a package")
.about("Show package(s) basic information")
.arg_required_else_help(true)
.arg(
Arg::new("package")
.help("Name of the package to be inspected")
Arg::new("query")
.help("The query string (regex supported)")
.required(true),
),
)
Expand Down Expand Up @@ -323,7 +323,7 @@ pub fn build() -> Command {
)
.subcommand(
Command::new("unhold")
.about("Unhold package(s) to enable updates")
.about("Unhold package(s) to enable changes")
.arg_required_else_help(true)
.arg(
Arg::new("package")
Expand Down Expand Up @@ -381,7 +381,7 @@ pub fn build() -> Command {
)
.subcommand(
Command::new("update")
.about("Fetch and update all buckets")
.about("Fetch and update subscribed buckets")
.alias("u"),
)
.subcommand(
Expand Down
2 changes: 2 additions & 0 deletions src/cmd/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ pub fn cmd_config(matches: &ArgMatches, session: &Session) -> Result<()> {
.map(|s| s.as_str())
.unwrap_or_default();
operation::config_set(session, key, value)?;
println!("Config '{}' has been set to '{}'", key, value);
Ok(())
}
Some(("unset", args)) => {
Expand All @@ -39,6 +40,7 @@ pub fn cmd_config(matches: &ArgMatches, session: &Session) -> Result<()> {
.map(|s| s.as_str())
.unwrap_or_default();
operation::config_set(session, key, "")?;
println!("Config '{}' has been unset", key);
Ok(())
}
_ => unreachable!(),
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/hold.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub fn cmd_hold(matches: &ArgMatches, session: &Session) -> Result<()> {
.unwrap_or_default();

for name in packages {
print!("Holding {}... ", name);
print!("Holding {}...", name);
match operation::package_hold(session, name, true) {
Ok(..) => {
println!("{}", "Ok".green());
Expand Down
13 changes: 9 additions & 4 deletions src/cmd/info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,23 @@ use libscoop::{operation, Session};
use crate::Result;

pub fn cmd_info(matches: &ArgMatches, session: &Session) -> Result<()> {
if let Some(query) = matches.get_one::<String>("package") {
if let Some(query) = matches.get_one::<String>("query") {
let queries = vec![query.as_str()];
let options = vec![];
let packages = operation::package_query(session, queries, options, false)?;
let length = packages.len();
match length {
0 => eprintln!("Could not find package for query '{}'.", query),
_ => {
println!("Found {} package(s) for query '{}':", length, query);
if length == 1 {
println!("Found 1 package for query '{}':", query);
} else {
println!("Found {} package(s) for query '{}':", length, query);
}

for (idx, pkg) in packages.iter().enumerate() {
// Ident
// println!("Identity: {}/{}", pkg.bucket, pkg.name);
println!("Identity: {}", pkg.ident());
// Name
println!("Name: {}", pkg.name());
// Bucket
Expand All @@ -30,7 +35,7 @@ pub fn cmd_info(matches: &ArgMatches, session: &Session) -> Result<()> {
// Homepage
println!("Homepage: {}", pkg.homepage());
// License
// println!("License: {}", pkg.license);
println!("License: {}", pkg.license());
// Binaries
println!(
"Shims: {}",
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/unhold.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub fn cmd_unhold(matches: &ArgMatches, session: &Session) -> Result<()> {
.unwrap_or_default();

for name in packages {
print!("Unholding {}... ", name);
print!("Unholding {}...", name);
match operation::package_hold(session, name, false) {
Ok(..) => {
println!("{}", "Ok".green());
Expand Down

0 comments on commit ccf6672

Please sign in to comment.