mirror of
https://github.com/oh-my-fish/oh-my-fish.git
synced 2024-11-27 18:59:40 +08:00
22 lines
568 B
Fish
22 lines
568 B
Fish
function ta.cli.undo
|
|
if test $__ta_undo_lock = false
|
|
if test (ta.util.tasks.count) -gt 0
|
|
# Display task for the last time.
|
|
ta.util.get.tail | grep -E --color=always ".*"
|
|
|
|
if sed -Ei.bak '$ d' $__ta_file_data
|
|
rm $__ta_file_data.bak
|
|
else
|
|
set -l code $status
|
|
cp $__ta_file_data.bak $__ta_file_data
|
|
return $code
|
|
end
|
|
set -g __ta_undo_lock true
|
|
else
|
|
echo "There are no tasks."
|
|
return $__ta_error_no_tasks
|
|
end
|
|
end
|
|
echo "The undo stack is locked until a new task is added."
|
|
end
|