Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wr/replace multiline commands #402

Merged
merged 4 commits into from
Oct 23, 2023
Merged

Conversation

WillieRuemmele
Copy link
Contributor

What does this PR do?

allows the dev convert command to handle mult-line commands like

sfdx force:user:create -f config/user-def.json \
  -a myuser \
  -o myorg

and converts them

sf org create user --definition-file config/user-def.json \
 --set-alias myuser \
 --target-org myorg 

What issues does this PR fix or reference?

@W-14135637@

@iowillhoit
Copy link
Contributor

iowillhoit commented Oct 17, 2023

QA NOTES

I linked plugin-dev and ran sf dev convert script --script test/commands/dev/convert/samples/script.sh

  • 🟢 Multiline commands render correctly
  • 🟡 sf force:source:deploy turning into sf force source deploy
    • Shouldn't this be sf project deploy start
  • 🟡 Multi-line commands lose trailing padding
# multi line commands
sfdx force:user:create -f config/user-def.json \
  -a myuser \
  -o myorg

sfdx alias:set user=myuser

turns into:

# multi line commands
sf org create user --definition-file config/user-def.json \
 --set-alias myuser \
 --target-org myorg 
sf alias set user=myuser
  • 🟡 Running the command multiple times will turn multiline commands to a single line
    • sf org create user --definition-file config/user-def.json \--set-alias myuser \--target-org myorgsf alias set user=myuser
  • 🟡 If the final command is a unconvertible multi-line command, it will end with undefined
sf force org create \
  --definitionfile config/project-scratch-def.json \
  --setalias myorg \
  --setdefaultusername \
  --durationdays 1

turns into:

sf force org create \
 --definitionfile config/project-scratch-def.json \
 --setalias myorg \
 --setdefaultusername \
 --durationdays 1undefined # <- note "undefined"
  • 🟡 Also the indentation is wrong post convert on this previous example ^
    • The indentation goes from 2 spaces to 1

Copy link
Contributor

@iowillhoit iowillhoit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See QA notes. I will push the additional commands i was using for testing

@iowillhoit
Copy link
Contributor

QA UPDATE

  • 🟡 sf force:source:deploy is now turning into sf force source deploy, but the # ERROR: Unable to convert this command; you must convert it manually. warning is still getting added to the command?
  • 🟢 Multi-line commands padding looks good now!
  • 🟢 Running the command multiple times no longer turns a multiline commands into single line
  • 🟢 End of file undefined no longer happening
  • 🟢 Multiline indentation is now preserved

@WillieRuemmele WillieRuemmele merged commit 8ff2d44 into main Oct 23, 2023
8 checks passed
@WillieRuemmele WillieRuemmele deleted the wr/replaceMultilineCommands branch October 23, 2023 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants