omnifocus_cli 0.1.0
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 +7 -0
- data/README.md +63 -0
- data/Rakefile +10 -0
- data/exe/of +6 -0
- data/lib/omnifocus_cli/cli.rb +78 -0
- data/lib/omnifocus_cli/database.rb +64 -0
- data/lib/omnifocus_cli/version.rb +5 -0
- data/lib/omnifocus_cli.rb +9 -0
- data/sig/omnifocus_cli.rbs +4 -0
- metadata +79 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 63da50c9cf8b8c65bea6492d9e0e3d2210a2c8d0278a41e629e62b419055bb40
|
|
4
|
+
data.tar.gz: 7aac6dc6b6262e7d12bacc45fe109760744737e36caaa4f2194ef1e5eeca7764
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 4fbb7f3f1aa135b756237b0eb1dfc2e4ba137bb5721a4b85d4010468f01abaf93bdda363eccfa9a09f6af558c63fdd72307e5e8c20dd3c7f42af5b294a34f191
|
|
7
|
+
data.tar.gz: 25111bb4a3e43e1312f828056d8181bdd4bdcb9a0905653d15749c978d12b2d580d2f77a9a0b3e378940cd7b8c6501d6978b62731798f728e5650011983106be
|
data/README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# OmniFocus CLI
|
|
2
|
+
|
|
3
|
+
A command-line interface for querying OmniFocus data.
|
|
4
|
+
|
|
5
|
+
> **Warning**: This gem was vibe-coded with Claude. Use at your own risk.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
gem install omnifocus_cli
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Or build from source:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
git clone https://github.com/andyw8/omnifocus_cli
|
|
17
|
+
cd omnifocus_cli
|
|
18
|
+
bundle install
|
|
19
|
+
bundle exec rake install
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
### List tasks
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
of tasks # All available tasks
|
|
28
|
+
of tasks --inbox # Inbox tasks only
|
|
29
|
+
of tasks --project "Work" # Tasks in a specific project
|
|
30
|
+
of tasks --tag "Urgent" # Tasks with a specific tag
|
|
31
|
+
of tasks -p "Work" -t "Home" # Combine filters
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### List projects
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
of projects # All active projects
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### List tags
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
of tags # All tags
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Other commands
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
of --help # Show help
|
|
50
|
+
of --version # Show version
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Development
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
bundle install
|
|
57
|
+
bundle exec rake test # Run tests
|
|
58
|
+
bundle exec rake standard # Run linter
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Contributing
|
|
62
|
+
|
|
63
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/andyw8/omnifocus_cli.
|
data/Rakefile
ADDED
data/exe/of
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "optparse"
|
|
4
|
+
|
|
5
|
+
module OmnifocusCli
|
|
6
|
+
class CLI
|
|
7
|
+
def initialize(argv = ARGV)
|
|
8
|
+
@argv = argv
|
|
9
|
+
@options = {}
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def run
|
|
13
|
+
parser.parse!(@argv)
|
|
14
|
+
|
|
15
|
+
if @options[:version]
|
|
16
|
+
puts "of #{OmnifocusCli::VERSION}"
|
|
17
|
+
return 0
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
if @options[:help] || @argv.empty?
|
|
21
|
+
puts parser
|
|
22
|
+
return 0
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
command = @argv.shift
|
|
26
|
+
db = Database.new
|
|
27
|
+
case command
|
|
28
|
+
when "tasks"
|
|
29
|
+
puts db.tasks(project: @options[:project], tag: @options[:tag], inbox: @options[:inbox])
|
|
30
|
+
0
|
|
31
|
+
when "projects"
|
|
32
|
+
puts db.projects
|
|
33
|
+
0
|
|
34
|
+
when "tags"
|
|
35
|
+
puts db.tags
|
|
36
|
+
0
|
|
37
|
+
when "count"
|
|
38
|
+
puts "Total tasks: #{db.task_count}"
|
|
39
|
+
0
|
|
40
|
+
when "help"
|
|
41
|
+
puts parser
|
|
42
|
+
0
|
|
43
|
+
else
|
|
44
|
+
warn "Unknown command: #{command}"
|
|
45
|
+
warn "Available commands: tasks, projects, tags, count, help"
|
|
46
|
+
1
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
private
|
|
51
|
+
|
|
52
|
+
def parser
|
|
53
|
+
@parser ||= OptionParser.new do |opts|
|
|
54
|
+
opts.banner = "Usage: of [options] [command]"
|
|
55
|
+
|
|
56
|
+
opts.on("-v", "--version", "Show version") do
|
|
57
|
+
@options[:version] = true
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
opts.on("-h", "--help", "Show this help") do
|
|
61
|
+
@options[:help] = true
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
opts.on("-p", "--project PROJECT", "Filter by project name") do |p|
|
|
65
|
+
@options[:project] = p
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
opts.on("-t", "--tag TAG", "Filter by tag name") do |t|
|
|
69
|
+
@options[:tag] = t
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
opts.on("-i", "--inbox", "Show only inbox tasks") do
|
|
73
|
+
@options[:inbox] = true
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "sequel"
|
|
4
|
+
|
|
5
|
+
module OmnifocusCli
|
|
6
|
+
class Database
|
|
7
|
+
DEFAULT_PATH = File.expand_path(
|
|
8
|
+
"~/Library/Group Containers/34YW5XSRB7.com.omnigroup.OmniFocus/com.omnigroup.OmniFocus4/com.omnigroup.OmniFocusModel/OmniFocusDatabase.db"
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
def initialize(path = DEFAULT_PATH)
|
|
12
|
+
@db = Sequel.sqlite(path, readonly: true)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def task_count
|
|
16
|
+
@db[:Task].count
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def tasks(project: nil, tag: nil, inbox: nil)
|
|
20
|
+
t = Sequel[:Task]
|
|
21
|
+
|
|
22
|
+
dataset = @db[:Task].where(
|
|
23
|
+
t[:dateCompleted] => nil,
|
|
24
|
+
t[:projectInfo] => nil,
|
|
25
|
+
t[:blocked] => 0,
|
|
26
|
+
t[:blockedByFutureStartDate] => 0
|
|
27
|
+
).exclude(t[:name] => nil)
|
|
28
|
+
|
|
29
|
+
dataset = dataset.where(t[:effectiveInInbox] => 1) if inbox
|
|
30
|
+
|
|
31
|
+
if project
|
|
32
|
+
dataset = dataset
|
|
33
|
+
.join(:ProjectInfo, pk: t[:containingProjectInfo])
|
|
34
|
+
.join(Sequel[:Task].as(:pt), persistentIdentifier: Sequel[:ProjectInfo][:task])
|
|
35
|
+
.where(Sequel[:pt][:name] => project)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
if tag
|
|
39
|
+
dataset = dataset
|
|
40
|
+
.join(:TaskToTag, task: t[:persistentIdentifier])
|
|
41
|
+
.join(:Context, persistentIdentifier: Sequel[:TaskToTag][:tag])
|
|
42
|
+
.where(Sequel[:Context][:name] => tag)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
dataset.select(t[:name]).order(t[:name]).map(:name)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def projects
|
|
49
|
+
@db[:Task]
|
|
50
|
+
.join(:ProjectInfo, task: :persistentIdentifier)
|
|
51
|
+
.where(Sequel[:ProjectInfo][:effectiveStatus] => "active")
|
|
52
|
+
.select(Sequel[:Task][:name])
|
|
53
|
+
.order(Sequel[:Task][:name])
|
|
54
|
+
.map(:name)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def tags
|
|
58
|
+
@db[:Context]
|
|
59
|
+
.exclude(name: nil)
|
|
60
|
+
.order(:name)
|
|
61
|
+
.map(:name)
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: omnifocus_cli
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Andy Waite
|
|
8
|
+
bindir: exe
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: sequel
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - "~>"
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '5.0'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - "~>"
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '5.0'
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: sqlite3
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - "~>"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '2.0'
|
|
33
|
+
type: :runtime
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - "~>"
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '2.0'
|
|
40
|
+
description: Command-line interface for OmniFocus
|
|
41
|
+
email:
|
|
42
|
+
- andyw8@users.noreply.github.com
|
|
43
|
+
executables:
|
|
44
|
+
- of
|
|
45
|
+
extensions: []
|
|
46
|
+
extra_rdoc_files: []
|
|
47
|
+
files:
|
|
48
|
+
- README.md
|
|
49
|
+
- Rakefile
|
|
50
|
+
- exe/of
|
|
51
|
+
- lib/omnifocus_cli.rb
|
|
52
|
+
- lib/omnifocus_cli/cli.rb
|
|
53
|
+
- lib/omnifocus_cli/database.rb
|
|
54
|
+
- lib/omnifocus_cli/version.rb
|
|
55
|
+
- sig/omnifocus_cli.rbs
|
|
56
|
+
homepage: https://github.com/andyw8/omnifocus_cli
|
|
57
|
+
licenses: []
|
|
58
|
+
metadata:
|
|
59
|
+
allowed_push_host: https://rubygems.org
|
|
60
|
+
homepage_uri: https://github.com/andyw8/omnifocus_cli
|
|
61
|
+
source_code_uri: https://github.com/andyw8/omnifocus_cli
|
|
62
|
+
rdoc_options: []
|
|
63
|
+
require_paths:
|
|
64
|
+
- lib
|
|
65
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
66
|
+
requirements:
|
|
67
|
+
- - ">="
|
|
68
|
+
- !ruby/object:Gem::Version
|
|
69
|
+
version: 3.2.0
|
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - ">="
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: '0'
|
|
75
|
+
requirements: []
|
|
76
|
+
rubygems_version: 3.6.9
|
|
77
|
+
specification_version: 4
|
|
78
|
+
summary: CLI for OmniFocus
|
|
79
|
+
test_files: []
|