anchor.diff:      %% Parse getopt options
       OptSpecList = option_spec_list(),
       case getopt:parse(OptSpecList, Args) of
  -        {ok, {_Options, []}} ->
  -            %% no command to run specified
  -            help(),
  -            halt(1);
           {ok, {Options, NonOptArgs}} ->
  -            case proplists:get_bool(help, Options) of
  -                true ->
  -                    %% display help
  -                    help(),
  -                    halt(0);
  -                false ->
  -                    %% Set global variables based on getopt options
  -                    set_global_flag(Options, verbose),
  -                    set_global_flag(Options, force),
  -                    DefJobs = rebar_config:get_jobs(),
  -                    case proplists:get_value(jobs, Options, DefJobs) of
  -                        DefJobs ->
  -                            ok;
  -                        Jobs ->
  -                            rebar_config:set_global(jobs, Jobs)
  -                    end,
  -
  -                    %% Filter all the flags (i.e. strings of form key=value) from the
  -                    %% command line arguments. What's left will be the commands to run.
  -                    filter_flags(NonOptArgs, [])
  -            end;
  +            %% Check options and maybe halt execution
  +            {ok, continue} = print_help_maybe_halt(Options, NonOptArgs),
  +
  +            %% Set global variables based on getopt options
  +            set_global_flag(Options, verbose),
  +            set_global_flag(Options, force),
  +            DefJobs = rebar_config:get_jobs(),
  +            case proplists:get_value(jobs, Options, DefJobs) of
  +                DefJobs ->
  +                    ok;
  +                Jobs ->
  +                    rebar_config:set_global(jobs, Jobs)
  +            end,
  +
  +            %% Filter all the flags (i.e. strings of form key=value) from the
  +            %% command line arguments. What's left will be the commands to run.
  +            filter_flags(NonOptArgs, []);
  +
           {error, {Reason, Data}} ->
               ?ERROR("Error: ~s ~p~n~n", [Reason, Data]),
               help(),
  
positive.code:         [Jobs]),
      [
       %% {Name, ShortOpt, LongOpt, ArgSpec, HelpMsg}
       {help,    $h, "help",    undefined, "Show the program options"},
       {verbose, $v, "verbose", undefined, "Be verbose about what gets done"},
       {force,   $f, "force",   undefined, "Force"},
       {jobs,    $j, "jobs",    integer, JobsHelp}
      ].
  
  %%
  
negative.code:     rebar_config:set_global(Flag, Value).
  
  %%
  %% print help
  %%
  print_help_maybe_halt(Options, NonOptArgs) ->
      case proplists:get_bool(help, Options) of
          true ->
              help(),
              halt(0);
          false ->
              case proplists:get_bool(commands, Options) of
                  true ->
                      commands(),
                      halt(0);
                  false ->
                      case NonOptArgs of
                          [] ->
                              io:format("No command to run specified!~n"),
                              help(),
                              halt(1);
                          _ ->
                              {ok, continue}
                      end
              end
      end.
  
  %%
  %% print help/usage string
  %%
  help() ->
  