-
-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- IMPROVED: Better formatting for JSON output - NEW: --no-menu option for select command to use --query as a filter and act on matching entries without displaying menu
- Loading branch information
Showing
12 changed files
with
250 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module Doing | ||
VERSION = '1.0.88' | ||
VERSION = '1.0.89' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/Users/ttscoff/Desktop/Code/doing/lib/doing/../helpers/fuzzyfilefinder | ||
/Users/ttscoff/Desktop/Code/doing/lib/doing/../helpers/fuzzyfilefinder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
require 'fileutils' | ||
require 'tempfile' | ||
require 'time' | ||
require 'yaml' | ||
|
||
require 'doing-helpers' | ||
require 'test_helper' | ||
|
||
# Tests for entry modifying commands | ||
class DoingDayTest < Test::Unit::TestCase | ||
include DoingHelpers | ||
ENTRY_REGEX = /^\d{4}-\d\d-\d\d \d\d:\d\d \|/.freeze | ||
|
||
def setup | ||
@tmpdirs = [] | ||
@result = '' | ||
@basedir = mktmpdir | ||
@wwid_file = File.join(@basedir, 'wwid.md') | ||
@config_file = File.join(File.dirname(__FILE__), 'test.doingrc') | ||
end | ||
|
||
def teardown | ||
FileUtils.rm_rf(@tmpdirs) | ||
end | ||
|
||
def test_today_command | ||
subject = 'Test new entry @tag1' | ||
doing('done', subject) | ||
subject2 = 'Test new entry 2 @tag2' | ||
doing('now', subject2) | ||
assert_count_entries(2, doing('today'), 'There should be 2 entries shown by `doing today`') | ||
end | ||
|
||
def test_yesterday_command | ||
doing('done', 'Adding an entry finished yesterday', '--took', '30m', '--back', 'yesterday 3pm') | ||
assert_count_entries(1, doing('yesterday'), 'There should be 1 entry shown by `doing yesterday`') | ||
end | ||
|
||
def test_on_command | ||
# 1:42pm: Did a thing @done(2021-07-05 13:42) | ||
doing('now', 'Test new entry @tag1') | ||
doing('now', 'Test new entry 2 @tag2') | ||
result = doing('--stdout', 'on', 'today') | ||
assert_count_entries(2, result, 'There should be 2 entries') | ||
end | ||
|
||
private | ||
|
||
def assert_count_entries(count, shown, message = 'Should be X entries shown') | ||
assert_equal(count, shown.uncolor.strip.scan(ENTRY_REGEX).count, message) | ||
end | ||
|
||
def mktmpdir | ||
tmpdir = Dir.mktmpdir | ||
@tmpdirs.push(tmpdir) | ||
|
||
tmpdir | ||
end | ||
|
||
def doing(*args) | ||
doing_with_env({}, '--config_file', @config_file, '--doing_file', @wwid_file, *args) | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
require 'fileutils' | ||
require 'tempfile' | ||
require 'time' | ||
require 'yaml' | ||
|
||
require 'doing-helpers' | ||
require 'test_helper' | ||
|
||
# Tests for entry modifying commands | ||
class DoingLastTest < Test::Unit::TestCase | ||
include DoingHelpers | ||
|
||
def setup | ||
@tmpdirs = [] | ||
@result = '' | ||
@basedir = mktmpdir | ||
@wwid_file = File.join(@basedir, 'wwid.md') | ||
@config_file = File.join(File.dirname(__FILE__), 'test.doingrc') | ||
@import_file = File.join(File.dirname(__FILE__), 'All Activities 2.json') | ||
end | ||
|
||
def teardown | ||
FileUtils.rm_rf(@tmpdirs) | ||
end | ||
|
||
def test_last_command | ||
subject = 'Test new entry @tag1' | ||
doing('import', @import_file) | ||
doing('now', subject) | ||
assert_match(/#{subject}\s*$/, doing('last'), 'last entry should be entry just added') | ||
end | ||
|
||
def test_last_search_and_tag | ||
unique_keyword = 'jumping jesus' | ||
unique_tag = 'balloonpants' | ||
doing('now', "Test new entry @#{unique_tag} sad monkey") | ||
doing('now', "Test new entry @tag2 #{unique_keyword}") | ||
doing('now', 'Test new entry @tag3 burly man') | ||
|
||
assert_match(/#{unique_keyword}/, doing('last', '--search', unique_keyword), 'returned entry should contain unique keyword') | ||
assert_match(/@#{unique_tag}/, doing('last', '--tag', unique_tag), 'returned entry should contain unique tag') | ||
end | ||
|
||
private | ||
|
||
def mktmpdir | ||
tmpdir = Dir.mktmpdir | ||
@tmpdirs.push(tmpdir) | ||
|
||
tmpdir | ||
end | ||
|
||
def doing(*args) | ||
doing_with_env({}, '--config_file', @config_file, '--doing_file', @wwid_file, *args) | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.