xuuki-do-list 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 52201be4d5a2317a6eb1add43aa43dae5a4d8e0af639643f653b133e5be93162
4
+ data.tar.gz: 85a6d79f5e9f2a4c8113bbc29c06352d0224b9b2c5e235d10c028625ad040669
5
+ SHA512:
6
+ metadata.gz: 9b7e55f63ab771cf835fe8a60c106152e212d68bee89f52749f75fa2a7ae0f19a1e115679fd5fc98aa91a592104d70b243982aabdae9af045d72e61a04690ab8
7
+ data.tar.gz: d833f02e20b9934dcee7bd085cadb4603b0eeadd8f3b368491530cddcd9eb95baf40123b1f700643aea5c4f9e259f1d5e62cab9c1a783725d2de56f3b6d20c5d
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ .bundle/
2
+ Gemfile.lock
3
+ bundle-install.log
4
+ vendor/
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
data/README.rdoc ADDED
@@ -0,0 +1,6 @@
1
+ = xuuki-do-list
2
+
3
+ Describe your project here
4
+
5
+ :include:xuuki-do-list.rdoc
6
+
data/Rakefile ADDED
@@ -0,0 +1,21 @@
1
+ require 'rake/clean'
2
+ require 'rubygems'
3
+ require 'rubygems/package_task'
4
+ require 'rdoc/task'
5
+ Rake::RDocTask.new do |rd|
6
+ rd.main = "README.rdoc"
7
+ rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
8
+ rd.title = 'xuuki-do-list'
9
+ end
10
+
11
+ spec = Gem::Specification.load("xuuki-do-list.gemspec")
12
+
13
+ Gem::PackageTask.new(spec) do |pkg|
14
+ end
15
+ require 'rake/testtask'
16
+ Rake::TestTask.new do |t|
17
+ t.libs << "test"
18
+ t.test_files = FileList['test/*_test.rb']
19
+ end
20
+
21
+ task :default => :test
data/bin/xuuki-do-list ADDED
@@ -0,0 +1,145 @@
1
+ #!/usr/bin/env ruby
2
+ require 'gli'
3
+ # begin # XXX: Remove this begin/rescue before distributing your app
4
+ require 'xuuki-do-list'
5
+
6
+ require 'rubygems'
7
+ include GLI::App
8
+
9
+ TODO_FILE = File.expand_path('~/todo.txt')
10
+
11
+ class App
12
+ extend GLI::App
13
+
14
+ program_desc 'Manage tasks in a todo list'
15
+
16
+ version XuukiToDo::VERSION
17
+
18
+ subcommand_option_handling :normal
19
+ arguments :strict
20
+
21
+ desc 'Path to the todo file'
22
+ default_value '~/.todo.txt'
23
+ arg_name 'todo_file'
24
+ flag [:f,:filename]
25
+
26
+ def self.write_todo(file, name, created = Time.now, completed = '')
27
+ file.puts("#{name},#{created},#{completed}")
28
+ end
29
+
30
+ def self.read_todo(line)
31
+ line.chomp.split(/,/)
32
+ end
33
+
34
+ desc 'Create a new task in the task list'
35
+ long_desc """
36
+ A task has a name and a priority. By default, new tasks
37
+ have the lowest possible priority, though this can be
38
+ overridden.
39
+ """
40
+
41
+ arg_name 'task_name'
42
+ command :new do |c|
43
+ c.desc 'set the priority of the new task, 1 being the highest'
44
+ c.arg_name 'priority'
45
+ c.flag :p
46
+
47
+ c.desc 'put the new task first in the list'
48
+ c.arg_name 'priority'
49
+ c.switch :f
50
+
51
+ c.action do |global_options,options,args|
52
+ puts "Global:"
53
+ puts "-f - #{global_options[:f]}"
54
+ puts "Command:"
55
+ puts "-f - #{options[:f] ? 'true' : 'false'}"
56
+ puts "-p - #{options[:p]}"
57
+ puts "args - #{args.join(',')}"
58
+
59
+ # Your command logic here
60
+ new_task = ARGV.shift
61
+
62
+ File.open(TODO_FILE,'a') do |file|
63
+ write_todo(file,new_task)
64
+ puts "Task added."
65
+ end
66
+ end
67
+ end
68
+
69
+ desc 'List tasks'
70
+ arg_name 'Describe arguments to list here'
71
+ command :list do |c|
72
+ c.action do |global_options, options, args|
73
+ File.open(TODO_FILE,'r') do |file|
74
+ counter = 1
75
+ file.readlines.each do |line|
76
+ name,created,completed = read_todo(line)
77
+ printf("%3d - %s\n",counter,name)
78
+ printf(" Created : %s\n",created)
79
+ unless completed.nil?
80
+ printf(" Completed : %s\n",completed)
81
+ end
82
+ counter += 1
83
+ end
84
+ end
85
+ end
86
+ end
87
+
88
+ desc 'Complete a task'
89
+ arg_name 'Describe arguments to done here'
90
+ command :done do |c|
91
+ c.action do |global_options,options,args|
92
+ puts "Global:"
93
+ puts "-f - #{global_options[:f]}"
94
+
95
+ task_number = ARGV.shift.to_i
96
+ if File.exist?(TODO_FILE)
97
+ File.open(TODO_FILE, 'r') do |file|
98
+ File.open("#{TODO_FILE}.new", 'w') do |new_file|
99
+ counter = 1
100
+ file.readlines.each do |line|
101
+ name, created, completed = line.chomp.split(/,/)
102
+ if task_number == counter
103
+ new_file.puts("#{name},#{created},#{Time.now}")
104
+ puts "Task #{counter} completed"
105
+ else
106
+ new_file.puts("#{name},#{created},#{completed}")
107
+ end
108
+ counter += 1
109
+ end
110
+ end
111
+ end
112
+ `mv #{TODO_FILE}.new #{TODO_FILE}`
113
+ else
114
+ puts "No such file: #{TODO_FILE}"
115
+ end
116
+
117
+
118
+
119
+
120
+ end
121
+ end
122
+
123
+ pre do |global,command,options,args|
124
+ # Pre logic here
125
+ # Return true to proceed; false to abort and not call the
126
+ # chosen command
127
+ # Use skips_pre before a command to skip this block
128
+ # on that command only
129
+ true
130
+ end
131
+
132
+ post do |global,command,options,args|
133
+ # Post logic here
134
+ # Use skips_post before a command to skip this
135
+ # block on that command only
136
+ end
137
+
138
+ on_error do |exception|
139
+ # Error logic here
140
+ # return false to skip default error handling
141
+ true
142
+ end
143
+ end
144
+
145
+ exit App.run(ARGV)
@@ -0,0 +1,3 @@
1
+ module XuukiToDo
2
+ VERSION = '0.0.1'
3
+ end
@@ -0,0 +1,4 @@
1
+ require 'xuuki-do-list/version.rb'
2
+
3
+ # Add requires for other files you add to your project here, so
4
+ # you just need to require this one file in your bin file
@@ -0,0 +1,14 @@
1
+ require_relative "test_helper"
2
+
3
+ class DefaultTest < Minitest::Test
4
+
5
+ def setup
6
+ end
7
+
8
+ def teardown
9
+ end
10
+
11
+ def test_the_truth
12
+ assert true
13
+ end
14
+ end
@@ -0,0 +1,4 @@
1
+ require "minitest/autorun"
2
+
3
+ # Add test libraries you want to use here, e.g. mocha
4
+ # Add helper classes or methods here, too
data/to-do.md ADDED
@@ -0,0 +1,76 @@
1
+ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
2
+ ┃ To-Do Command Suite Documentation ┃
3
+ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
4
+
5
+
6
+ SYNOPSIS
7
+
8
+
9
+ to-do [global options] <command> [command options] [arguments]
10
+
11
+
12
+
13
+ DESCRIPTION
14
+
15
+ The to-do command suite is a task management tool that allows
16
+ users to create, list, and complete tasks. Each task can have a
17
+ name and a priority, with new tasks defaulting to the lowest
18
+ priority unless specified otherwise.
19
+
20
+
21
+ OPTIONS
22
+
23
+ • Global Options:
24
+ • -f : Flag to modify global behavior (details depend on
25
+ command context).
26
+ • Command Options:
27
+ • new:
28
+ • -f : Add the new task to the top of the list.
29
+ • -p priority : Set the task's priority, with 1 being the
30
+ highest.
31
+
32
+
33
+ EXAMPLES
34
+
35
+ • Create a new task:
36
+
37
+ to-do new "Task Name" -p 1
38
+
39
+ Adds a new task with high priority.
40
+ • List tasks:
41
+
42
+ to-do list
43
+
44
+ Displays all tasks.
45
+ • Mark a task as done:
46
+
47
+ to-do done 1
48
+
49
+ Marks the first task as completed.
50
+
51
+
52
+ FILES
53
+
54
+ • todo.txt : Default file where tasks are stored.
55
+
56
+
57
+ ENVIRONMENT
58
+
59
+ • No specific environment variables are required.
60
+
61
+
62
+ BUGS
63
+
64
+ • Known issue: The new command currently expects no arguments,
65
+ which may cause confusion.
66
+
67
+
68
+ LICENSE
69
+
70
+ This software is licensed under the MIT License. See the LICENSE
71
+ file for details.
72
+
73
+
74
+ AUTHOR
75
+
76
+ Developed by [Your Name] - [Your Email]
@@ -0,0 +1,22 @@
1
+ # Ensure we require the local version and not one we might have installed already
2
+ require File.join([File.dirname(__FILE__),'lib','xuuki-do-list','version.rb'])
3
+ spec = Gem::Specification.new do |s|
4
+ s.name = 'xuuki-do-list'
5
+ s.version = XuukiToDo::VERSION
6
+ s.author = 'Joel Nash'
7
+ s.email = 'joel.nash@xuuki.xyz'
8
+ s.homepage = 'http://www.xuuki.xyz'
9
+ s.platform = Gem::Platform::RUBY
10
+ s.summary = 'Manage tasks in a todo list'
11
+ s.files = `git ls-files`.split("
12
+ ")
13
+ s.require_paths << 'lib'
14
+ s.extra_rdoc_files = ['README.rdoc','xuuki-do-list.rdoc']
15
+ s.rdoc_options << '--title' << 'xuuki-do-list' << '--main' << 'README.rdoc' << '-ri'
16
+ s.bindir = 'bin'
17
+ s.executables << 'xuuki-do-list'
18
+ s.add_development_dependency('rake')
19
+ s.add_development_dependency('rdoc')
20
+ s.add_development_dependency('minitest')
21
+ s.add_runtime_dependency('gli','~> 2.22.1')
22
+ end
@@ -0,0 +1,5 @@
1
+ = xuuki-do-list
2
+
3
+ Generate this with
4
+ xuuki-do-list _doc
5
+ After you have described your command line interface
metadata ADDED
@@ -0,0 +1,114 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: xuuki-do-list
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Joel Nash
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 2025-01-21 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: rake
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '0'
19
+ type: :development
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: '0'
26
+ - !ruby/object:Gem::Dependency
27
+ name: rdoc
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ - !ruby/object:Gem::Dependency
41
+ name: minitest
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ type: :development
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ - !ruby/object:Gem::Dependency
55
+ name: gli
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: 2.22.1
61
+ type: :runtime
62
+ prerelease: false
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: 2.22.1
68
+ email: joel.nash@xuuki.xyz
69
+ executables:
70
+ - xuuki-do-list
71
+ extensions: []
72
+ extra_rdoc_files:
73
+ - README.rdoc
74
+ - xuuki-do-list.rdoc
75
+ files:
76
+ - ".gitignore"
77
+ - Gemfile
78
+ - README.rdoc
79
+ - Rakefile
80
+ - bin/xuuki-do-list
81
+ - lib/xuuki-do-list.rb
82
+ - lib/xuuki-do-list/version.rb
83
+ - test/default_test.rb
84
+ - test/test_helper.rb
85
+ - to-do.md
86
+ - xuuki-do-list.gemspec
87
+ - xuuki-do-list.rdoc
88
+ homepage: http://www.xuuki.xyz
89
+ licenses: []
90
+ metadata: {}
91
+ rdoc_options:
92
+ - "--title"
93
+ - xuuki-do-list
94
+ - "--main"
95
+ - README.rdoc
96
+ - "-ri"
97
+ require_paths:
98
+ - lib
99
+ - lib
100
+ required_ruby_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ required_rubygems_version: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ requirements: []
111
+ rubygems_version: 3.6.3
112
+ specification_version: 4
113
+ summary: Manage tasks in a todo list
114
+ test_files: []