Skip to content

slightly more helpful help, if it's helpful #7

Description

@mong8se

I know the idea is to be lightweight as possible, but here is a slightly more helpful help, if it's helpful for anybody.

It omits the help and default tasks from the list of commands, and then displays the contents of the default task:

function help {
  echo "$0 <task> <args>"
  echo "Tasks:"
  compgen -A function | grep -v 'help\|default' | cat -n
  echo
  type default | sed -e '1d; 2s/()/task:/; s/^/    /'
  echo
}

The output looks like this, for an example Taskfile with a slightly complicated default for illustration:

./Taskfile <task> <args>
Tasks:
     1	install
     2	build
     3	run
     4	update
     5	upgrade

    default task: 
    { 
        update;
        for file in src/*;
        do
            upgrade $file;
        done
    }

Task completed in 0m0.003s

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions