~fancycade/nrg

5da413cfbc9b7e5559f7c1f3875f31165f887e1f — fancycade 1 year, 6 months ago f5d6191
Add special command 'format' to run crystal tool format
1 files changed, 10 insertions(+), 6 deletions(-)

M main.cr
M main.cr => main.cr +10 -6
@@ 19,13 19,17 @@ else
  if File.exists? "shard.yml"
    data = YAML.parse(File.read("shard.yml"))
    command = ARGV[0]
    s = data["scripts"][command].to_s
    s.lines.each do |l|
      if l.includes? "?"
        system(apply_args(l))
      else
        system(l)
    if command != "format"
      s = data["scripts"][command].to_s
      s.lines.each do |l|
        if l.includes? "?"
          system(apply_args(l))
        else
          system(l)
        end
      end
    else
      system("crystal tool format")
    end
  else
    raise "Can't find shard.yml in this directory"