truffle icon indicating copy to clipboard operation
truffle copied to clipboard

enable migration's `save` option for yargs.

Open lsqproduction opened this issue 2 years ago • 11 comments

Addresses #5495 Previously, Migration.js allows users to run a migration without saving it on chain, but the option wasn't added for yargs.

Since this is added in yargs now, truffle migrate help will also show this option, but do we want to document this on truffle website?

I do feel these migrations are a bit abrupt at the end. Should we add a nice message too to indicate again that the migrations weren't saved on chain? Similar to the ones for on chain migrations like this

Summary
=======
 Migrations not saved on chain

lsqproduction avatar Sep 08 '22 17:09 lsqproduction

Since this is added in yargs now, truffle migrate help will also show this option

Hm, it looks like it wasn't added to the help section though... doesn't it also needd to be added there for it to show up?

but do we want to document this on truffle website?

I'd say so, yes!

haltman-at avatar Sep 08 '22 20:09 haltman-at

I think @gnidan and I talked about this and decided to fix it but leave it undocumented. Do you still feel the same @gnidan?

eggplantzzz avatar Sep 13 '22 15:09 eggplantzzz

@eggplantzzz can you help me understand how this is different than dry run?

lsqproduction avatar Sep 13 '22 16:09 lsqproduction

Oh sorry I misunderstood, this PR is for fixing the bug and not documenting it in the help system. This should be good!

eggplantzzz avatar Sep 13 '22 17:09 eggplantzzz

I think @gnidan and I talked about this and decided to fix it but leave it undocumented. Do you still feel the same @gnidan?

Yes I still feel this way

gnidan avatar Sep 13 '22 18:09 gnidan

Since we don't want to document this, I've added hide property for this option so it won't show up in truffle migrate help .

lsqproduction avatar Sep 13 '22 21:09 lsqproduction

Since this is added in yargs now, truffle migrate help will also show this option

Hm, it looks like it wasn't added to the help section though... doesn't it also needd to be added there for it to show up?

but do we want to document this on truffle website?

I'd say so, yes!

interesting discovery, the help section is used by displayCommandHelp() and the builder is used by yargs default command help. We have two different ways of displaying command help. truffle cmd help and truffle help cmd

lsqproduction avatar Sep 13 '22 21:09 lsqproduction

Can you elaborate a little bit more on what the hide and hidden properties do here? I'm not familiar with what they do.

eggplantzzz avatar Sep 14 '22 14:09 eggplantzzz

Can you elaborate a little bit more on what the hide and hidden properties do here? I'm not familiar with what they do.

good catch. My bad, the hidden is supposed to be hide this hides the key from the generated usage information. hidden is also a valid opt key for yargs

lsqproduction avatar Sep 14 '22 18:09 lsqproduction

Well do note that yargs does not ingest stuff in the help property so that won't actually have any effect on them. However it looks like we have a mechanism for hiding options here. Looks like if an option gets an internal property that is truthy it ignores it while printing. A better name for this would be hide like you have here.

I would suggest you change this property name to hide and update all options that have the internal field set to true to use hide instead. Do you feel like doing that?

eggplantzzz avatar Sep 15 '22 14:09 eggplantzzz

Nice catch @eggplantzzz on the internal. I can't seem to find much documentation for this one. I do see only compile has this internal key as truthy. I can change this out too. Am I missing any other instances with internal?

lsqproduction avatar Sep 15 '22 15:09 lsqproduction

hidden is actually the correct property to use.

lsqproduction avatar Sep 26 '22 14:09 lsqproduction

Cool, this is looking good.

eggplantzzz avatar Sep 26 '22 17:09 eggplantzzz