Skip to content

Too much boilerplate #16

@cgay

Description

@cgay

If I'm writing a command-line tool that takes one command-line option, I shouldn't have to add 10 lines of boilerplate code on top of my flag definition. I should just be able to say something like this (not trying to use the existing type names below):

define flag $build-directory-flag
  = make(<flag>, name: "build-directory", type: <string>, required?: #t);

define function main ()
  init-dylan-application(); // Do standard stuff like parsing the command line
  ensure-directories-exist($build-directory-flag.flag-value);
  ...
end;

It shouldn't be necessary to make a command line parser object, or add the options to it or catch errors to display help and usage.

Maybe the command-line-parser library can just have a single global parser object (since that should work for just about everything except testing), register flags for it in the make method, and provide a macro to do the help/usage handling.

Maybe we need an application library that has init-dylan-application as in the code snippet above. This could take keyword args to enable/disable various standard things like logging, command-line parsing, etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions