Skip to content

Added confirmation before uploading #27

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
23 changes: 21 additions & 2 deletions bin/showterm
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,36 @@ class Showterm::Main

else

if '-e' == ARGV[0] || '--edit' == ARGV[0]
@edit_timings = true
while true
if ['-e', '--edit'].include?(ARGV[0])
@edit_timings = true
elsif ['-n', '--noconfirm'].include?(ARGV[0])
@no_confirm = true
elsif ['-ne', '-en'].include?(ARGV[0])
@edit_timings, @no_confirm = true, true
else
break
end
ARGV.shift
end

sf, tf = record
sf, tf = edit(sf, tf) if @edit_timings
abort_upload! unless @no_confirm or confirm
upload sf, tf
end
end

def abort_upload!
puts 'Upload aborted.'
exit 1
end

def confirm
print 'Upload recording? (y/n)> '
/y(es)?/i =~ STDIN.gets.chomp()
end

def record
puts 'showterm recording. (Exit shell when done.)'
sf, tf = Showterm.record!(*ARGV)
Expand Down