I opened a discussion on this feature a month ago (link below), I suppose it didn't take notice, so I picked it up and implemented the feature myself on my free time, and I'm happy to contribute it back :).
Added --with-prelude option to sea-orm-cli generate entity command, it accepts 3 values:
[1] all: the default value, cli tool behaves as it does right now (so no breaking changes), it will generates the prelude.rs file and add it to mod.rs (or lib.rs).
[2] none: it WILL NOT generates the prelude.rs file and it WILL NOT add it to mod.rs.
[3] all-allow-unused-imports: it generates the prelude.rs file and add it to mod.rs, BUT the following inner attribute #![allow(unused_imports)] is appended to prelude.rs heading, see below:
This is how it looks like with --with-prelude=all:
This is how it looks like with --with-prelude=all-allow-unused-imports:
I opened a discussion on this feature a month ago (link below), I suppose it didn't take notice, so I picked it up and implemented the feature myself on my free time, and I'm happy to contribute it back :).
PR Info
New Features
Added
--with-prelude
option tosea-orm-cli generate entity
command, it accepts 3 values:all
: the default value, cli tool behaves as it does right now (so no breaking changes), it will generates theprelude.rs
file and add it tomod.rs
(orlib.rs
).none
: it WILL NOT generates theprelude.rs
file and it WILL NOT add it tomod.rs
.all-allow-unused-imports
: it generates theprelude.rs
file and add it tomod.rs
, BUT the following inner attribute#![allow(unused_imports)]
is appended toprelude.rs
heading, see below:This is how it looks like with
--with-prelude=all
:This is how it looks like with
--with-prelude=all-allow-unused-imports
: