gonuit / rps

Define and use scripts from your pubspec.yaml file.
MIT License
44 stars 8 forks source link

Multiple commands #4

Open om-ha opened 2 years ago

om-ha commented 2 years ago

Hey there! Great library.

Can you define multiple commands to be run within the same keyword?

scripts:
   run:
      "fvm flutter pub clean"
      "fvm flutter pub get"
      "fvm flutter pub run build_runner watch --delete-conflicting-outputs"

Because otherwise we have to do the following which is really not ideal:

scripts:
   run: "fvm flutter pub clean && fvm flutter pub get && fvm flutter pub run build_runner watch --delete-conflicting-outputs"
mbtodorov commented 1 year ago

Hello 👋 You should be able to run multi-line commands in one of the following ways:

  1. Prefixing the commands with | or > to define multiline strings. This is standard YAML syntax:
scripts:
  lint: |
    dart format .
    dart analyze --fatal-infos
  1. Creating a dedicated .sh file:
    • pubspec.yaml:
      scripts:
      lint: "./scripts/lint.sh"
    • scripts/lint.sh:
      
      #!/bin/sh

dart format . dart analyze --fatal-infos

gonuit commented 1 year ago

I will add an explanation to the readme of the package 👌🏻, Thank you @mbtodorov, for your help and explanation.