xuuki-do-list 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0e88cd31b063664b3f9eef917b9da3443f6ca0f511dbf9928ac08fb075a826db
4
- data.tar.gz: c36e56e2fb6baabee7fb856e3afad82007b113bb9627bc276a83098544e127f1
3
+ metadata.gz: 0daa6a403e1d6ab8c83720f52ed1d1e4b4b79bb3fe4bc56c20be356b4b25e2f8
4
+ data.tar.gz: ed4a888b57548ae616b85818edab6246ae1473c0e0570ea27832ff24512d0f21
5
5
  SHA512:
6
- metadata.gz: a11da4bf49507df0294196b513ea084fc8e167189a975271e2d6d962a2ed538c8694f07e5f304cfdb91c00a2bbb360523041bd55b6a6997438389b510026d417
7
- data.tar.gz: db699dc8c423914778a0746fc4cb4844f25c7f4682bca572243ffbfe3043e1122d65dab8a4c8e972ef7ba1951c391c5540928546489073753b1ca1232fd4613d
6
+ metadata.gz: bd54c3957ae40151b68111bc590bb120467bee4ec23a1685d4d729d09578a3b8e6c724e8abf4862829b192c92db031134632662773a7c6afceb0005fdceaab67
7
+ data.tar.gz: f7b090ae9ed6e589427121828ecf4d5969e21939d576f995c3f6834419de757086efce1ad70b39ad65d07791d67bb3270857f31392136ebe12ffcf5ad883d3d0
data/Rakefile CHANGED
@@ -2,6 +2,7 @@ require 'rake/clean'
2
2
  require 'rubygems'
3
3
  require 'rubygems/package_task'
4
4
  require 'rdoc/task'
5
+
5
6
  Rake::RDocTask.new do |rd|
6
7
  rd.main = "README.rdoc"
7
8
  rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
data/bin/xuuki-do-list CHANGED
@@ -1,6 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'gli'
3
- # begin # XXX: Remove this begin/rescue before distributing your app
4
3
  require 'xuuki-do-list'
5
4
 
6
5
  require 'rubygems'
@@ -10,13 +9,14 @@ TODO_FILE = File.expand_path('~/todo.txt')
10
9
 
11
10
  class App
12
11
  extend GLI::App
12
+ config_file File.join(ENV['HOME'],'.xuuki-do-list.rc.yaml')
13
13
 
14
14
  program_desc 'Manage tasks in a todo list'
15
15
 
16
16
  version XuukiToDo::VERSION
17
17
 
18
18
  subcommand_option_handling :normal
19
- arguments :strict
19
+ # arguments :strict
20
20
 
21
21
  desc 'Path to the todo file'
22
22
  default_value '~/.todo.txt'
@@ -39,6 +39,7 @@ class App
39
39
  """
40
40
 
41
41
  arg_name 'task_name'
42
+
42
43
  command :new do |c|
43
44
  c.desc 'set the priority of the new task, 1 being the highest'
44
45
  c.arg_name 'priority'
@@ -54,12 +55,13 @@ class App
54
55
  puts "Command:"
55
56
  puts "-f - #{options[:f] ? 'true' : 'false'}"
56
57
  puts "-p - #{options[:p]}"
57
- puts "args - #{args.join(',')}"
58
+ puts "args - #{args.join(' ')}"
59
+ todo_file = File.expand_path(global_options[:f] || TODO_FILE)
58
60
 
59
61
  # Your command logic here
60
62
  new_task = ARGV.shift
61
63
 
62
- File.open(TODO_FILE,'a') do |file|
64
+ File.open(todo_file,'a') do |file|
63
65
  write_todo(file,new_task)
64
66
  puts "Task added."
65
67
  end
@@ -75,8 +77,15 @@ class App
75
77
  c.flag :format
76
78
 
77
79
  c.action do |global_options, options, args|
80
+ puts "Global:"
81
+ puts "-f - #{global_options[:f]}"
82
+ puts "Command:"
83
+ puts "-f - #{options[:f] ? 'true' : 'false'}"
84
+ puts "-p - #{options[:p]}"
85
+ puts "args - #{args.join(' ')}"
86
+ todo_file = File.expand_path(global_options[:f] || TODO_FILE)
78
87
 
79
- File.open(TODO_FILE,'r') do |file|
88
+ File.open(todo_file,'r') do |file|
80
89
  counter = 1
81
90
 
82
91
  file.readlines.each do |line|
@@ -105,11 +114,16 @@ class App
105
114
  c.action do |global_options,options,args|
106
115
  puts "Global:"
107
116
  puts "-f - #{global_options[:f]}"
117
+ puts "Command:"
118
+ puts "-f - #{options[:f] ? 'true' : 'false'}"
119
+ puts "-p - #{options[:p]}"
120
+ puts "args - #{args.join(' ')}"
121
+ todo_file = File.expand_path(global_options[:f] || TODO_FILE)
108
122
 
109
123
  task_number = ARGV.shift.to_i
110
- if File.exist?(TODO_FILE)
111
- File.open(TODO_FILE, 'r') do |file|
112
- File.open("#{TODO_FILE}.new", 'w') do |new_file|
124
+ if File.exist?(todo_file)
125
+ File.open(todo_file, 'r') do |file|
126
+ File.open("#{todo_file}.new", 'w') do |new_file|
113
127
  counter = 1
114
128
  file.readlines.each do |line|
115
129
  name, created, completed = line.chomp.split(/,/)
@@ -123,9 +137,9 @@ class App
123
137
  end
124
138
  end
125
139
  end
126
- `mv #{TODO_FILE}.new #{TODO_FILE}`
140
+ `mv #{todo_file}.new #{todo_file}`
127
141
  else
128
- puts "No such file: #{TODO_FILE}"
142
+ puts "No such file: #{todo_file}"
129
143
  end
130
144
  end
131
145
  end