Doit task for updating completion on new version

8 views
Skip to first unread message

Balakrishnan B

unread,
Jul 18, 2017, 12:06:03 AM7/18/17
to python-doit
I want to create a task that updates the shell completion file. I have the below and it works.

def task_version():
   
return {'actions': ["doit --version"]}


def task_update_completion():
   
from doit.tools import result_dep
    zsh_completion_file
= '~/.zsh/tabcompletion/_doit'
   
return {
           
'actions' : [f'doit tabcompletion --shell=zsh > {zsh_completion_file}'],
           
'uptodate': [result_dep('version')],
           
'verbosity' : 2
           
}


Is there a way to avoid creating a 'version' task just for tracking its dependency? I don't want to see version in doit list or in autocompletion. Is there a way to hide the task? It would be good nice to pass arbitrary python function for result_dep. E.g

def task_update_completion():
   
from doit.tools import result_dep
    zsh_completion_file
= '~/.zsh/tabcompletion/_doit'
   
def get_ver():
       
return doit.get_version()
   
return {
           
'actions' : [f'doit tabcompletion --shell=zsh > {zsh_completion_file}'],
           
'uptodate': [result_dep(get_ver)],
           
'verbosity' : 2
           
}

Please share if there is a better way to create a task for tab completion update.

Thanks,
Bala
Reply all
Reply to author
Forward
0 new messages