chmln / handlr

A better xdg-utils
MIT License
616 stars 24 forks source link

Clap Error #69

Closed ProfessorManhattan closed 1 year ago

ProfessorManhattan commented 1 year ago

Hey, I tried installing this via cargo and ran into the following issue:

   Compiling xdg-mime v0.3.3
   Compiling thiserror-impl v1.0.38
   Compiling freedesktop_entry_parser v1.3.0
   Compiling pest v2.5.3
   Compiling pest_meta v2.5.3
   Compiling pest_generator v2.5.3
   Compiling pest_derive v2.5.3
   Compiling toml v0.5.10
   Compiling confy v0.4.0
   Compiling handlr v0.6.4
error[E0432]: unresolved import `clap::Clap`
  --> /Users/bzalewski/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/handlr-0.6.4/src/main.rs:13:9
   |
13 |     use clap::Clap;
   |         ^^^^^^^^^^ no `Clap` in the root

error[E0433]: failed to resolve: could not find `Clap` in `clap`
 --> /Users/bzalewski/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/handlr-0.6.4/src/cli.rs:3:16
  |
3 | #[derive(clap::Clap)]
  |                ^^^^ could not find `Clap` in `clap`

error: cannot find attribute `clap` in this scope
 --> /Users/bzalewski/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/handlr-0.6.4/src/cli.rs:4:3
  |
4 | #[clap(global_setting = clap::AppSettings::DeriveDisplayOrder)]
  |   ^^^^
  |
  = note: `clap` is in scope, but it is a crate, not an attribute

error: cannot find attribute `clap` in this scope
 --> /Users/bzalewski/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/handlr-0.6.4/src/cli.rs:5:3
  |
5 | #[clap(global_setting = clap::AppSettings::DisableHelpSubcommand)]
  |   ^^^^
  |
  = note: `clap` is in scope, but it is a crate, not an attribute

error: cannot find attribute `clap` in this scope
 --> /Users/bzalewski/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/handlr-0.6.4/src/cli.rs:6:3
  |
6 | #[clap(version = clap::crate_version!())]
  |   ^^^^
  |
  = note: `clap` is in scope, but it is a crate, not an attribute

error: cannot find attribute `clap` in this scope
  --> /Users/bzalewski/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/handlr-0.6.4/src/cli.rs:10:11
   |
10 |         #[clap(long, short)]
   |           ^^^^
   |
   = note: `clap` is in scope, but it is a crate, not an attribute

error: cannot find attribute `clap` in this scope
  --> /Users/bzalewski/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/handlr-0.6.4/src/cli.rs:16:11
   |
16 |         #[clap(required = true)]
   |           ^^^^
   |
   = note: `clap` is in scope, but it is a crate, not an attribute

error: cannot find attribute `clap` in this scope
  --> /Users/bzalewski/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/handlr-0.6.4/src/cli.rs:37:11
   |
37 |         #[clap(long)]
   |           ^^^^
   |
   = note: `clap` is in scope, but it is a crate, not an attribute

error: cannot find attribute `clap` in this scope
  --> /Users/bzalewski/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/handlr-0.6.4/src/cli.rs:49:7
   |
49 |     #[clap(setting = clap::AppSettings::Hidden)]
   |       ^^^^
   |
   = note: `clap` is in scope, but it is a crate, not an attribute

error: cannot find attribute `clap` in this scope
  --> /Users/bzalewski/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/handlr-0.6.4/src/cli.rs:51:11
   |
51 |         #[clap(short)]
   |           ^^^^
   |
   = note: `clap` is in scope, but it is a crate, not an attribute

error: cannot find attribute `clap` in this scope
  --> /Users/bzalewski/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/handlr-0.6.4/src/cli.rs:53:11
   |
53 |         #[clap(short)]
   |           ^^^^
   |
   = note: `clap` is in scope, but it is a crate, not an attribute

error[E0599]: no variant or associated item named `parse` found for enum `Cmd` in the current scope
  --> /Users/bzalewski/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/handlr-0.6.4/src/main.rs:24:20
   |
24 |         match Cmd::parse() {
   |                    ^^^^^ variant or associated item not found in `Cmd`
   |
  ::: /Users/bzalewski/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/handlr-0.6.4/src/cli.rs:7:1
   |
7  | pub enum Cmd {
   | ------------ variant or associated item `parse` not found for this enum
   |
   = help: items from traits can only be used if the trait is implemented and in scope
   = note: the following traits define an item `parse`, perhaps you need to implement one of them:
           candidate #1: `pest::Parser`
           candidate #2: `StructOpt`
           candidate #3: `TypedValueParser`
           candidate #4: `nom::sequence::Tuple`
           candidate #5: `nom::internal::Parser`
           candidate #6: `nom::sequence::Tuple`

Some errors have detailed explanations: E0432, E0433, E0599.
For more information about an error, try `rustc --explain E0432`.
error: could not compile `handlr` due to 12 previous errors
error: failed to compile `handlr v0.6.4`, intermediate artifacts can be found at `/var/folders/x9/h7fm2vmj051gdkt4t_6l_k700000gq/T/cargo-installBDH6JN`

Project seems cool. Thanks for the contribution.

Mart-Bogdan commented 1 year ago

I have same error. Have no idea why it works in Github actiions

I've just done cargo install handlr

$ rustc --version                                                                                                                                                                                                              
rustc 1.67.1 (d5a82bbd2 2023-02-07)
llc0930 commented 1 year ago

cargo install handlr --locked Enjoy it.

Mart-Bogdan commented 1 year ago

Wow. So cargo don't use lock file by default? WTF 0_O

llc0930 commented 1 year ago

Github actiions https://github.com/chmln/handlr/actions/runs/797939843/workflow

You mean this one?

anoduck commented 1 year ago

Yes, I received this error, and yes, the above suggestion by @lolicon0930 resolved that error.

cargo install handlr --locked Enjoy it.

@chmln Might want to update the README.md to reflect this change.

@ProfessorManhattan might give it a try, and if successful, close the issue now.

ProfessorManhattan commented 1 year ago

Thanks @lolicon0930 --- the --locked flag did the trick