mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-24 16:14:07 +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.basic_auth ENV['GTD_LOGIN'], ENV['GTD_PASSWORD']
|
||||||
req.body = "<todo>#{props}</todo>"
|
req.body = "<todo>#{props}</todo>"
|
||||||
|
|
||||||
puts req.body
|
|
||||||
|
|
||||||
resp = http.request(req)
|
resp = http.request(req)
|
||||||
|
|
||||||
if resp.code == '302' || resp.code == '201'
|
if resp.code == '302' || resp.code == '201'
|
||||||
|
|
@ -212,6 +210,11 @@ module Gtd
|
||||||
|
|
||||||
cmd.on('-f [S]', "filename of the template") do |v|
|
cmd.on('-f [S]', "filename of the template") do |v|
|
||||||
@filename = v
|
@filename = v
|
||||||
|
|
||||||
|
if not File.exist?(@filename)
|
||||||
|
puts "ERROR: file #{@filename} doesn't exist"
|
||||||
|
exit 1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
cmd.on('-c [N]', Integer, 'default context id to set for new projects') do |v|
|
cmd.on('-c [N]', Integer, 'default context id to set for new projects') do |v|
|
||||||
|
|
@ -233,11 +236,6 @@ module Gtd
|
||||||
# lines = STDIN.read
|
# lines = STDIN.read
|
||||||
gtd = API.new
|
gtd = API.new
|
||||||
|
|
||||||
if not File.exist?(@filename)
|
|
||||||
puts "ERROR: file #{@filename} doesn't exist"
|
|
||||||
exit 1
|
|
||||||
end
|
|
||||||
|
|
||||||
if ENV['GTD_LOGIN'] == nil
|
if ENV['GTD_LOGIN'] == nil
|
||||||
puts "ERROR: no GTD_LOGIN environment variable set"
|
puts "ERROR: no GTD_LOGIN environment variable set"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
@ -248,7 +246,11 @@ module Gtd
|
||||||
exit 1
|
exit 1
|
||||||
end
|
end
|
||||||
|
|
||||||
file = File.open(@filename)
|
if @filename.nil?
|
||||||
|
file = STDIN
|
||||||
|
else
|
||||||
|
file = File.open(@filename)
|
||||||
|
end
|
||||||
|
|
||||||
# if lines.strip.empty?
|
# if lines.strip.empty?
|
||||||
# puts "Please pipe in some content to tracks on STDIN."
|
# puts "Please pipe in some content to tracks on STDIN."
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue