The Crystal Programming Language Forum

Are Process arguments overcomplicated?

Imagine, we have a tuple of command argument we want to run with Process. Currently, we’ll have to do something like:

args = {"ffprobe",
  "-v", "error", "-show_entries", "format=duration",
  "-of", "default=noprint_wrappers=1:nokey=1", file}

ary_args = args.to_a # intermediate array, ary_args)

But it feels more natural to do it like:

args = {"ffprobe",
        "-v", "error", "-show_entries", "format=duration",
        "-of", "default=noprint_wrappers=1:nokey=1", file} args
# or *args

Even with array of arguments it feels more handy to do it like:

args = %w[ffprobe -v error -show_entries format=duration
        -of default=noprint_wrappers=1:nokey=1] << file
# ^^^ have to shovel (Array#<<) into the array, since we don't have interpolated arrays %W[] args

There probably was a reason for choosing the current format, but does it still stand?
What do you think?