mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-24 03:00:12 +01:00
permit using stdin
This commit is contained in:
parent
07634453ed
commit
a8a699da1f
1 changed files with 10 additions and 8 deletions
18
doc/tracks_template_cli.rb
Normal file → Executable file
18
doc/tracks_template_cli.rb
Normal file → Executable file
|
|
@ -109,8 +109,6 @@ module Gtd
|
|||
req.basic_auth ENV['GTD_LOGIN'], ENV['GTD_PASSWORD']
|
||||
req.body = "<todo>#{props}</todo>"
|
||||
|
||||
puts req.body
|
||||
|
||||
resp = http.request(req)
|
||||
|
||||
if resp.code == '302' || resp.code == '201'
|
||||
|
|
@ -212,6 +210,11 @@ module Gtd
|
|||
|
||||
cmd.on('-f [S]', "filename of the template") do |v|
|
||||
@filename = v
|
||||
|
||||
if not File.exist?(@filename)
|
||||
puts "ERROR: file #{@filename} doesn't exist"
|
||||
exit 1
|
||||
end
|
||||
end
|
||||
|
||||
cmd.on('-c [N]', Integer, 'default context id to set for new projects') do |v|
|
||||
|
|
@ -233,11 +236,6 @@ module Gtd
|
|||
# lines = STDIN.read
|
||||
gtd = API.new
|
||||
|
||||
if not File.exist?(@filename)
|
||||
puts "ERROR: file #{@filename} doesn't exist"
|
||||
exit 1
|
||||
end
|
||||
|
||||
if ENV['GTD_LOGIN'] == nil
|
||||
puts "ERROR: no GTD_LOGIN environment variable set"
|
||||
exit 1
|
||||
|
|
@ -248,7 +246,11 @@ module Gtd
|
|||
exit 1
|
||||
end
|
||||
|
||||
file = File.open(@filename)
|
||||
if @filename.nil?
|
||||
file = STDIN
|
||||
else
|
||||
file = File.open(@filename)
|
||||
end
|
||||
|
||||
# if lines.strip.empty?
|
||||
# puts "Please pipe in some content to tracks on STDIN."
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue