Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support tab-completion of (sub-)tasks and options/arguments #17

Open
s1341 opened this issue Oct 26, 2014 · 3 comments
Open

Support tab-completion of (sub-)tasks and options/arguments #17

s1341 opened this issue Oct 26, 2014 · 3 comments
Labels

Comments

@s1341
Copy link

s1341 commented Oct 26, 2014

It would be awesome if bangsh could include infrastructure to support completion of task and sub-task names as well as options/arguments.

Is there any chance you would add this functionality?

@bellthoven
Copy link
Owner

Hey, there!

I think it is a great idea!

I'll study some ways of implementing it. I think the first step would be implementing the contract for options/arguments parsing. For instance, if the subtask has the function b.task.options, so it must have all the opt.add_flag/add_opt calls.

The second step is creating the subtask that generates the content of the proper file that autocompletes, based on a template.

What do you think?

@s1341
Copy link
Author

s1341 commented Oct 27, 2014

Perhaps tasks can (optionally) implement task.<name>.complete functions? It would be great if sub-tasks and options would be 'automatically' completed by default.

BTW: do you have an example of tasks with sub-tasks?

@bellthoven
Copy link
Owner

We can think of implementing something like task.name.complete.

I have not tested it because I was not worried about subtasks, but I might work like this:

# "tasks/my_task/subtask.sh"
function btask.subtask.sh () {
  echo "a sub task"
}

# "tasks/my_task.sh"
function btask.my_task.run () {
  b.task.run "my_task/$1"
}

# on terminal:
./you_project my_task subtask

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants