I've just found the `--pretend` switch in `command...
# box-products
r
I've just found the
--pretend
switch in
commandbox-migrations
but I'm getting an error.
Copy code
migrate down --pretend down.sql

Parameter [once] has a value of ["down.sql"] which is not of type [boolean].
What have I misunderstood?
a
Looking at the error, is it expecting
--pretend=true
or
--pretend true
or something?
(I mean this is not what the docs say, but just reading between the lines)
r
The normal convention is that a switch is false by default but becomes true if used. Worryingly
Copy code
migrate down --once --pretend=true down.sql
appears to have actioned the
down
which is why I added the
--once
this time as insurance. I guess I'll have to dig into the source to see where I have it wrong.
Okay, to be fair I should have called the feature like...
Copy code
migrate down --once --pretend=true file=down.sql
...but that didn't make any difference. What I should have done is...
Copy code
migrate down --once --pretend file=down.sql
I guess that makes sense.
a
It's odd cos the few times I've tried to negotiate commandbox's way of handling command line params, it's bleated at me about using different styles (short vs long vs dashes vs no dashes etc / or something). I'd expect it to need
--file
not just
file
. But there's poss some well-thought-out reason for it. I'm just CB noob after all.
Glad you got it working. Sorry I was zero help. Is there a case here for the docs being made more clear? Or is it "yer just expected to know this shit"?
r
I think CommandBox is fairly consistent with its
--
prefixes. Other command line tools, not so much, which is where I also get confused. Another conversation I know but I would have thought
-h
when you want to be terse and
--help
when you want to be explicit should be the convention. Not all tools work like that I've found. The online docs seem to be behind the command line help which doesn't help. Also with the default position for these switches being
false
if you are explicit, as I was trying to be, and use
--once=true
they seems to be ignored. Maybe I'll take a hack at that. I think the issue is that these are meant to be argument that also operate as switches. I could test this but I've moved on now...
Copy code
migrate up once=true pretend=true file=up.sql
...and I guess that would work. Anyway, I appreciate your thoughts whilst our American friends "labor" today.
a
Are they labouring to find their lost letter Us? 😉
r
If only they would put the "s" they insist on adding to LEGO onto math I would be a lot happier. I'm so glad we gave them their independence 😉
😜 2