yugonline / cliNotes

cliNotes is a CLI terminal app developed in Rust that helps fast capture of Dev logs, Learning Notes and Code snippets
4 stars 0 forks source link

compilation problems #1

Open jstaples1 opened 8 months ago

jstaples1 commented 8 months ago

I was going to make a dockerfile for this project but I can't currently get the current checkout to compile. Is the repo possibly missing some recent commits? Errors below:


cargo build Compiling CliNotes v0.1.0 (/home/jason/CODE/RUST/git_repos/cliNotes) error: expected one of ,, =, or }, found CodeSnippet --> src/main.rs:19:5 18 DevLog(DevLog)
expected one of ,, =, or }
help: missing ,
19 CodeSnippet(Code)
^^^^^^^^^^^ unexpected token

error: expected , --> src/main.rs:19:5 | 19 | CodeSnippet(Code) | ^^^^^^^^^^^

error[E0412]: cannot find type Code in this scope --> src/main.rs:19:17 | 19 | CodeSnippet(Code) | ^^^^ not found in this scope

error[E0423]: expected value, found macro matches --> src/main.rs:51:11 | 51 | match matches.subcommand() { | ^^^^^^^ not a value

warning: unused import: Error --> src/dao.rs:2:36 2 use rusqlite::{params, Connection, Error, OptionalExtension}; ^^^^^

= note: #[warn(unused_imports)] on by default

error[E0277]: the trait bound Command: FromArgMatches is not satisfied --> src/main.rs:13:14 13 command: Command, ^^^^^^^ the trait FromArgMatches is not implemented for Command

= help: the following other types implement trait FromArgMatches: DevLog CliNotes Box

error[E0277]: the trait bound Command: Subcommand is not satisfied --> src/main.rs:13:14 13 command: Command, ^^^^^^^ the trait Subcommand is not implemented for Command

= help: the trait Subcommand is implemented for Box<T>

yugonline commented 8 months ago

Yeah I think I know why this is happening I tried the Unicode art in main just to have fun with it but that may have messed up the print statements and the subsequent compilations everywhere. I'll check it out tonight or tomorrow thanks for checking the project out 😊

jstaples1 commented 8 months ago

ok cool, i think there might be something wrong with the definition of the enum Command that is throwing off other lines of code, not sure

enum Command { DevLog(DevLog) CodeSnippet(Code) // ... other subcommands can be added in a similar manner ... }

On Sat, Jan 20, 2024 at 5:11 PM Yug Shende @.***> wrote:

Yeah I think I know why this is happening I tried the Unicode art in main just to have fun with it but that may have messed up the print statements and the subsequent compilations everywhere. I'll check it out tonight or tomorrow thanks for checking the project out 😊

— Reply to this email directly, view it on GitHub https://github.com/yugonline/cliNotes/issues/1#issuecomment-1902468281, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARSKNYJFHMV2LICSQMQUJDYPRTK3AVCNFSM6AAAAABCDSM5F2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBSGQ3DQMRYGE . You are receiving this because you authored the thread.Message ID: @.***>

c-git commented 8 months ago

I can confirm that I am able to reproduce this in a GitHub codespace and got the following error:

error: expected one of `,`, `=`, or `}`, found `CodeSnippet`
  --> src/main.rs:19:5
   |
18 |     DevLog(DevLog)
   |                   -
   |                   |
   |                   expected one of `,`, `=`, or `}`
   |                   help: missing `,`
19 |     CodeSnippet(Code)
   |     ^^^^^^^^^^^ unexpected token

error: expected `,`
  --> src/main.rs:19:5
   |
19 |     CodeSnippet(Code)
   |     ^^^^^^^^^^^

error[E0412]: cannot find type `Code` in this scope
  --> src/main.rs:19:17
   |
19 |     CodeSnippet(Code)
   |                 ^^^^ not found in this scope

error[E0423]: expected value, found macro `matches`
  --> src/main.rs:51:11
   |
51 |     match matches.subcommand() {
   |           ^^^^^^^ not a value

warning: unused import: `Error`
 --> src/dao.rs:2:36
  |
2 | use rusqlite::{params, Connection, Error, OptionalExtension};
  |                                    ^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

error[E0277]: the trait bound `Command: FromArgMatches` is not satisfied
  --> src/main.rs:13:14
   |
13 |     command: Command,
   |              ^^^^^^^ the trait `FromArgMatches` is not implemented for `Command`
   |
   = help: the following other types implement trait `FromArgMatches`:
             DevLog
             CliNotes
             Box<T>

error[E0277]: the trait bound `Command: Subcommand` is not satisfied
  --> src/main.rs:13:14
   |
13 |     command: Command,
   |              ^^^^^^^ the trait `Subcommand` is not implemented for `Command`
   |
   = help: the trait `Subcommand` is implemented for `Box<T>`

Some errors have detailed explanations: E0277, E0412, E0423.
For more information about an error, try `rustc --explain E0277`.
warning: `CliNotes` (bin "CliNotes") generated 1 warning
error: could not compile `CliNotes` (bin "CliNotes") due to 8 previous errors; 1 warning emitted
@c-git ➜ /workspaces/cliNotes (main) $ 
yugonline commented 8 months ago

Hey folks. This is going to take some time. So, the actual problem was that the CodeSnippet struct was unavailable, and the Subcommand derive macro was not imported. But when I tried to redo this, I realized a huge problem with dao.rs. It should return the object struct instances to be truly helpful. I think it will take a lot of boilerplate code to get all of the essential SQL functions for CRUD working and two sets of structs (one for Clap and the other for ORM) to get this system to work.

So I have decided to ditch rusqlite in favour of Diesel. I have started the bare bones of this integration, but the initial diesel setup is not pretty; it will take some time but will be hugely beneficial in the long run. I plan to use some of my weekdays to continue to work on this.

c-git commented 8 months ago

You might also want to take a look at sqlx if you know sql already.

yugonline commented 7 months ago

Folks, here's an update. This project has been delayed once more. I have a few certification courses to get through this month and have a greenfield project deployment by mid feb. Really sorry on the delay. I will have something by our March meetup.

c-git commented 7 months ago

Thanks for the update