Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions bin/ti
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,15 @@ def action_status():
print('You have been working on {0} for {1}.'
.format(green(current['name']), diff))

def action_list(period):
data = store.load()
work = data['work'] + data['interrupt_stack']
names=[]
for item in work:
if not item['name'] in names:
names+=[item['name']]
print(item['name'])

def action_log(period):
data = store.load()
work = data['work'] + data['interrupt_stack']
Expand Down Expand Up @@ -391,6 +400,10 @@ def parse_args(argv=sys.argv):
fn = action_log
args = {'period': tail[0] if tail else None}

elif head in ['list']:
fn = action_list
args = {'period': tail[0] if tail else None}

elif head in ['t', 'tag']:
if not tail:
helpful_exit('Please provide at least one tag to add.')
Expand Down
19 changes: 19 additions & 0 deletions ti_bash_complete.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

## To use copy this file into /etc/bash_completion.d/
## and run . /etc/bash_completion.d/ti_bash_complete.sh
## or whatever makes sense on your system.

_ti()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts=$(ti list)

if [[ "on o" =~ ${prev} ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
fi
}
complete -F _ti ti