friends 0.49 → 0.54
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 +4 -4
- data/.github/CONTRIBUTING.md +1 -1
- data/.rubocop.yml +20 -5
- data/.travis.yml +6 -6
- data/CHANGELOG.md +76 -4
- data/Gemfile +2 -2
- data/README.md +29 -7
- data/RELEASING.md +1 -1
- data/bin/friends +3 -7
- data/friends.gemspec +3 -5
- data/lib/friends/commands/add.rb +12 -3
- data/lib/friends/commands/list.rb +5 -2
- data/lib/friends/commands/remove.rb +9 -0
- data/lib/friends/commands/update.rb +2 -2
- data/lib/friends/event.rb +2 -2
- data/lib/friends/friend.rb +5 -7
- data/lib/friends/graph.rb +1 -1
- data/lib/friends/introvert.rb +55 -17
- data/lib/friends/location.rb +40 -8
- data/lib/friends/post_install_message.rb +1 -2
- data/lib/friends/regex_builder.rb +8 -8
- data/lib/friends/sem_ver_comparator.rb +20 -0
- data/lib/friends/serializable.rb +1 -1
- data/lib/friends/version.rb +1 -1
- data/test/add_event_helper.rb +6 -4
- data/test/commands/add/alias_spec.rb +74 -0
- data/test/commands/add/nickname_spec.rb +9 -0
- data/test/commands/add/tag_spec.rb +9 -0
- data/test/commands/edit_spec.rb +1 -0
- data/test/commands/list/locations_spec.rb +14 -0
- data/test/commands/remove/alias_spec.rb +68 -0
- data/test/commands/remove/tag_spec.rb +9 -0
- data/test/commands/stats_spec.rb +1 -1
- data/test/editor +2 -0
- data/test/helper.rb +4 -2
- metadata +13 -28
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 555bc2e9643af62a0c4afb4d070d59de4ef54060d553e17d9eaa563bae82f1b5
|
|
4
|
+
data.tar.gz: a4f705f276a41c147aab67333c1ffec0ccc7bbba1ab454b9a014b7affa66f017
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3d8ca490b127f8a60e97e3dacd4cbc893ee33ad8959d8e3bf2c53289154a58e76714958dc29e297e74ff024ac86f3bbfb1e168e5eccc9bd37f178c6c41d903e7
|
|
7
|
+
data.tar.gz: 14159aa7682fd24ad0cab80d558b91a234eb6d5d52904828c45f6de595b281364da52080288c782b50488cf5ec40a30d36fc2c8e64a251c33924ac8d299fc0df
|
data/.github/CONTRIBUTING.md
CHANGED
|
@@ -55,7 +55,7 @@ promise I don't bite. 😊
|
|
|
55
55
|
|
|
56
56
|
## Code of Conduct
|
|
57
57
|
|
|
58
|
-
Note that this project follows a [Code of Conduct](https://github.com/JacobEvelyn/friends/blob/
|
|
58
|
+
Note that this project follows a [Code of Conduct](https://github.com/JacobEvelyn/friends/blob/main/CODE_OF_CONDUCT.md).
|
|
59
59
|
If you're a polite, reasonable person you won't have any issues!
|
|
60
60
|
|
|
61
61
|
## Financial contributions
|
data/.rubocop.yml
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
AllCops:
|
|
2
|
-
TargetRubyVersion: 2.
|
|
2
|
+
TargetRubyVersion: 2.3
|
|
3
3
|
|
|
4
4
|
Gemspec/RequiredRubyVersion:
|
|
5
5
|
Enabled: false
|
|
@@ -10,9 +10,18 @@ Layout/ClosingHeredocIndentation:
|
|
|
10
10
|
Layout/DotPosition:
|
|
11
11
|
EnforcedStyle: trailing
|
|
12
12
|
|
|
13
|
-
Layout/
|
|
13
|
+
Layout/HeredocIndentation:
|
|
14
14
|
Enabled: false
|
|
15
15
|
|
|
16
|
+
Layout/LineLength:
|
|
17
|
+
Max: 100
|
|
18
|
+
|
|
19
|
+
Lint/RaiseException:
|
|
20
|
+
Enabled: true
|
|
21
|
+
|
|
22
|
+
Lint/StructNewOverride:
|
|
23
|
+
Enabled: true
|
|
24
|
+
|
|
16
25
|
Metrics/AbcSize:
|
|
17
26
|
Enabled: false
|
|
18
27
|
|
|
@@ -28,9 +37,6 @@ Metrics/ClassLength:
|
|
|
28
37
|
Metrics/CyclomaticComplexity:
|
|
29
38
|
Enabled: false
|
|
30
39
|
|
|
31
|
-
Metrics/LineLength:
|
|
32
|
-
Max: 100
|
|
33
|
-
|
|
34
40
|
Metrics/MethodLength:
|
|
35
41
|
Enabled: false
|
|
36
42
|
|
|
@@ -46,6 +52,15 @@ Naming/AccessorMethodName:
|
|
|
46
52
|
Style/Documentation:
|
|
47
53
|
Enabled: false
|
|
48
54
|
|
|
55
|
+
Style/HashEachMethods:
|
|
56
|
+
Enabled: true
|
|
57
|
+
|
|
58
|
+
Style/HashTransformKeys:
|
|
59
|
+
Enabled: true
|
|
60
|
+
|
|
61
|
+
Style/HashTransformValues:
|
|
62
|
+
Enabled: true
|
|
63
|
+
|
|
49
64
|
Style/MultilineBlockChain:
|
|
50
65
|
Enabled: false
|
|
51
66
|
|
data/.travis.yml
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
language: ruby
|
|
2
|
+
cache: bundler
|
|
2
3
|
rvm:
|
|
3
|
-
- 2.1
|
|
4
|
-
- 2.2
|
|
5
4
|
- 2.3
|
|
6
5
|
- 2.4
|
|
7
|
-
- 2.5
|
|
6
|
+
- 2.5
|
|
7
|
+
- 2.6 # 2.7 is tested below
|
|
8
8
|
gemfile: Gemfile.old # The latest Ruby version uses Gemfile below
|
|
9
9
|
script:
|
|
10
10
|
- bundle exec rake test
|
|
11
11
|
matrix:
|
|
12
12
|
include:
|
|
13
|
-
- rvm: 2.
|
|
13
|
+
- rvm: 2.7
|
|
14
14
|
gemfile: Gemfile
|
|
15
15
|
script:
|
|
16
16
|
- bundle exec rake test
|
|
17
|
-
-
|
|
17
|
+
- bundle exec rubocop
|
|
18
18
|
env:
|
|
19
19
|
- CODE_COVERAGE=true
|
|
20
20
|
branches:
|
|
21
21
|
only:
|
|
22
|
-
-
|
|
22
|
+
- main # Always run on the main branch
|
|
23
23
|
notifications:
|
|
24
24
|
email: false
|
data/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,78 @@
|
|
|
4
4
|
making a small donation (🙏) with the **Sponsor** button at the top of this page to
|
|
5
5
|
show you appreciate its continued development.
|
|
6
6
|
|
|
7
|
+
## [v0.54](https://github.com/JacobEvelyn/friends/tree/v0.54) (2020-10-29)
|
|
8
|
+
|
|
9
|
+
[Full Changelog](https://github.com/JacobEvelyn/friends/compare/v0.53...v0.54)
|
|
10
|
+
|
|
11
|
+
**Implemented enhancements:**
|
|
12
|
+
|
|
13
|
+
- Add location nicknames [\#242](https://github.com/JacobEvelyn/friends/issues/242)
|
|
14
|
+
|
|
15
|
+
**Merged pull requests:**
|
|
16
|
+
|
|
17
|
+
- Add location alias [\#269](https://github.com/JacobEvelyn/friends/pull/269) ([RenCloud](https://github.com/RenCloud))
|
|
18
|
+
- Update codecov requirement from ~\> 0.1.14 to ~\> 0.2.0 [\#267](https://github.com/JacobEvelyn/friends/pull/267) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
|
|
19
|
+
|
|
20
|
+
## [v0.53](https://github.com/JacobEvelyn/friends/tree/v0.53) (2020-07-06)
|
|
21
|
+
|
|
22
|
+
[Full Changelog](https://github.com/JacobEvelyn/friends/compare/v0.52...v0.53)
|
|
23
|
+
|
|
24
|
+
**Fixed bugs:**
|
|
25
|
+
|
|
26
|
+
- undefined method error occurred when “add tag" or “add nickname” executed with no arguments [\#265](https://github.com/JacobEvelyn/friends/issues/265)
|
|
27
|
+
|
|
28
|
+
**Merged pull requests:**
|
|
29
|
+
|
|
30
|
+
- Fix for the case of add tag or add nickname args are nill [\#266](https://github.com/JacobEvelyn/friends/pull/266) ([m-t-a-n-a-k-a](https://github.com/m-t-a-n-a-k-a))
|
|
31
|
+
|
|
32
|
+
## [v0.52](https://github.com/JacobEvelyn/friends/tree/v0.52) (2020-06-03)
|
|
33
|
+
|
|
34
|
+
[Full Changelog](https://github.com/JacobEvelyn/friends/compare/v0.51...v0.52)
|
|
35
|
+
|
|
36
|
+
**Fixed bugs:**
|
|
37
|
+
|
|
38
|
+
- undefined method error occurred when "remove tag" is executed with no arguments [\#262](https://github.com/JacobEvelyn/friends/issues/262)
|
|
39
|
+
|
|
40
|
+
**Closed issues:**
|
|
41
|
+
|
|
42
|
+
- Try using bundler caching in Travis [\#260](https://github.com/JacobEvelyn/friends/issues/260)
|
|
43
|
+
|
|
44
|
+
**Merged pull requests:**
|
|
45
|
+
|
|
46
|
+
- Use correct RuboCop version in Travis [\#264](https://github.com/JacobEvelyn/friends/pull/264) ([JacobEvelyn](https://github.com/JacobEvelyn))
|
|
47
|
+
- Fix convert\_to\_tag for the case of str is nil [\#263](https://github.com/JacobEvelyn/friends/pull/263) ([m-t-a-n-a-k-a](https://github.com/m-t-a-n-a-k-a))
|
|
48
|
+
- Cache bundler directory in Travis [\#261](https://github.com/JacobEvelyn/friends/pull/261) ([JacobEvelyn](https://github.com/JacobEvelyn))
|
|
49
|
+
- Update rubocop requirement from 0.67 to 0.81.0 [\#259](https://github.com/JacobEvelyn/friends/pull/259) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview))
|
|
50
|
+
|
|
51
|
+
## [v0.51](https://github.com/JacobEvelyn/friends/tree/v0.51) (2020-04-05)
|
|
52
|
+
|
|
53
|
+
[Full Changelog](https://github.com/JacobEvelyn/friends/compare/v0.50...v0.51)
|
|
54
|
+
|
|
55
|
+
**Implemented enhancements:**
|
|
56
|
+
|
|
57
|
+
- Drop Semverse dependency [\#256](https://github.com/JacobEvelyn/friends/issues/256)
|
|
58
|
+
|
|
59
|
+
**Closed issues:**
|
|
60
|
+
|
|
61
|
+
- Drop support for Ruby \<2.3 [\#257](https://github.com/JacobEvelyn/friends/issues/257)
|
|
62
|
+
|
|
63
|
+
**Merged pull requests:**
|
|
64
|
+
|
|
65
|
+
- Remove Semverse dependency, and require Ruby 2.3+ [\#258](https://github.com/JacobEvelyn/friends/pull/258) ([JacobEvelyn](https://github.com/JacobEvelyn))
|
|
66
|
+
|
|
67
|
+
## [v0.50](https://github.com/JacobEvelyn/friends/tree/v0.50) (2020-04-03)
|
|
68
|
+
|
|
69
|
+
[Full Changelog](https://github.com/JacobEvelyn/friends/compare/v0.49...v0.50)
|
|
70
|
+
|
|
71
|
+
**Implemented enhancements:**
|
|
72
|
+
|
|
73
|
+
- Add support for Ruby 2.7 [\#254](https://github.com/JacobEvelyn/friends/issues/254)
|
|
74
|
+
|
|
75
|
+
**Merged pull requests:**
|
|
76
|
+
|
|
77
|
+
- Add Travis tests for Ruby 2.7 [\#255](https://github.com/JacobEvelyn/friends/pull/255) ([JacobEvelyn](https://github.com/JacobEvelyn))
|
|
78
|
+
|
|
7
79
|
## [v0.49](https://github.com/JacobEvelyn/friends/tree/v0.49) (2020-04-02)
|
|
8
80
|
|
|
9
81
|
[Full Changelog](https://github.com/JacobEvelyn/friends/compare/v0.48...v0.49)
|
|
@@ -24,7 +96,7 @@ show you appreciate its continued development.
|
|
|
24
96
|
|
|
25
97
|
**Implemented enhancements:**
|
|
26
98
|
|
|
27
|
-
- Change trigger for implicit location from `moved to
|
|
99
|
+
- Change trigger for implicit location from `moved to _LOCATION_` to `to _LOCATION_` [\#245](https://github.com/JacobEvelyn/friends/pull/245) ([shen-sat](https://github.com/shen-sat))
|
|
28
100
|
|
|
29
101
|
**Closed issues:**
|
|
30
102
|
|
|
@@ -45,7 +117,7 @@ show you appreciate its continued development.
|
|
|
45
117
|
|
|
46
118
|
**Fixed bugs:**
|
|
47
119
|
|
|
48
|
-
- Tests are failing in `
|
|
120
|
+
- Tests are failing in `main` [\#238](https://github.com/JacobEvelyn/friends/issues/238)
|
|
49
121
|
|
|
50
122
|
**Merged pull requests:**
|
|
51
123
|
|
|
@@ -309,7 +381,7 @@ show you appreciate its continued development.
|
|
|
309
381
|
|
|
310
382
|
**Implemented enhancements:**
|
|
311
383
|
|
|
312
|
-
- Add `--since
|
|
384
|
+
- Add `--since <date>` and `--until <date>` flags, and remove extraneous months from `graph` [\#153](https://github.com/JacobEvelyn/friends/issues/153)
|
|
313
385
|
- Add integration tests for bin/friends? [\#127](https://github.com/JacobEvelyn/friends/issues/127)
|
|
314
386
|
|
|
315
387
|
**Merged pull requests:**
|
|
@@ -598,7 +670,7 @@ show you appreciate its continued development.
|
|
|
598
670
|
**Merged pull requests:**
|
|
599
671
|
|
|
600
672
|
- Highlight multiple occurrences [\#70](https://github.com/JacobEvelyn/friends/pull/70) ([GuruKhalsa](https://github.com/GuruKhalsa))
|
|
601
|
-
- Fix Travis badge \(
|
|
673
|
+
- Fix Travis badge \(main only\) [\#67](https://github.com/JacobEvelyn/friends/pull/67) ([JacobEvelyn](https://github.com/JacobEvelyn))
|
|
602
674
|
- Move activity prompt to bin/friends [\#64](https://github.com/JacobEvelyn/friends/pull/64) ([JacobEvelyn](https://github.com/JacobEvelyn))
|
|
603
675
|
- Adds the --debug flag for printing backtraces on error [\#63](https://github.com/JacobEvelyn/friends/pull/63) ([JacobEvelyn](https://github.com/JacobEvelyn))
|
|
604
676
|
- Move file writes to end of command actions [\#61](https://github.com/JacobEvelyn/friends/pull/61) ([JacobEvelyn](https://github.com/JacobEvelyn))
|
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[](https://badge.fury.io/rb/friends)
|
|
2
|
-
[](https://codecov.io/gh/JacobEvelyn/friends)
|
|
3
|
+
[](https://travis-ci.com/JacobEvelyn/friends)
|
|
4
4
|
[](http://clayallsopp.github.io/readme-score?url=JacobEvelyn/friends)
|
|
5
5
|
[](http://inch-ci.org/github/JacobEvelyn/friends)
|
|
6
6
|
[](https://rubygems.org/gems/friends)
|
|
@@ -37,6 +37,7 @@ lots of help), and give feedback! This project is
|
|
|
37
37
|
- [`add tag`](#add-tag)
|
|
38
38
|
- [`add location`](#add-location)
|
|
39
39
|
- [`add nickname`](#add-nickname)
|
|
40
|
+
- [`add alias`](#add-alias)
|
|
40
41
|
- [Adding a default location](#adding-a-default-location)
|
|
41
42
|
- [`clean`](#clean)
|
|
42
43
|
- [`graph`](#graph)
|
|
@@ -54,6 +55,7 @@ lots of help), and give feedback! This project is
|
|
|
54
55
|
- `remove`
|
|
55
56
|
- [`remove tag`](#remove-tag)
|
|
56
57
|
- [`remove nickname`](#remove-nickname)
|
|
58
|
+
- [`remove alias`](#remove-alias)
|
|
57
59
|
- `rename`
|
|
58
60
|
- [`rename friend`](#rename-friend)
|
|
59
61
|
- [`rename location`](#rename-location)
|
|
@@ -181,7 +183,7 @@ The `friends.md` Markdown file that stores all of your data contains:
|
|
|
181
183
|
```
|
|
182
184
|
|
|
183
185
|
See the example
|
|
184
|
-
[`friends.md`](https://github.com/JacobEvelyn/friends/blob/
|
|
186
|
+
[`friends.md`](https://github.com/JacobEvelyn/friends/blob/main/friends.md)
|
|
185
187
|
file for more information.
|
|
186
188
|
|
|
187
189
|
### Global flags
|
|
@@ -291,11 +293,13 @@ $ friends add activity Got lunch with Earnest H and Earnest S. in the park. Man,
|
|
|
291
293
|
Activity added: "2017-05-01: Got lunch with Earnest Hemingway and Earnest Shackleton in the park. Man, I like Earnest Hemingway but really love Earnest Shackleton."
|
|
292
294
|
```
|
|
293
295
|
|
|
294
|
-
And locations will be matched as well:
|
|
296
|
+
And locations or their aliases will be matched as well:
|
|
295
297
|
|
|
296
298
|
```bash
|
|
297
299
|
$ friends add activity Went swimming near atlantis with George.
|
|
298
300
|
Activity added: "2017-01-06: Went swimming near Atlantis with George Washington Carver."
|
|
301
|
+
$ friends add activity Had lunch in nyc with George.
|
|
302
|
+
Activity added: "2017-01-06: Had lunch in New York City with George Washington Carver."
|
|
299
303
|
```
|
|
300
304
|
|
|
301
305
|
Tags will be colored if they're provided (though this README can't display
|
|
@@ -411,6 +415,15 @@ $ friends add nickname "Grace Hopper" "Amazing Grace"
|
|
|
411
415
|
Nickname added: "Grace Hopper (a.k.a. The Admiral a.k.a. Amazing Grace)"
|
|
412
416
|
```
|
|
413
417
|
|
|
418
|
+
#### `add alias`
|
|
419
|
+
|
|
420
|
+
```bash
|
|
421
|
+
$ friends add alias "New York City" "NYC"
|
|
422
|
+
Alias added: "New York City (a.k.a. NYC)
|
|
423
|
+
$ friends add alias "New York City" "Big Apple"
|
|
424
|
+
Alias added: "New York City (a.k.a. NYC a.k.a. Big Apple)"
|
|
425
|
+
```
|
|
426
|
+
|
|
414
427
|
#### Setting a default location
|
|
415
428
|
|
|
416
429
|
When an activity includes the phrase to \_LOCATION\_ (e.g., Took a plane to \_Paris\_), all future activities that have no explicit location will be associated with that location:
|
|
@@ -876,6 +889,15 @@ $ friends remove nickname "Grace Hopper" "The Admiral"
|
|
|
876
889
|
Nickname removed: "Grace Hopper (a.k.a. Amazing Grace)"
|
|
877
890
|
```
|
|
878
891
|
|
|
892
|
+
#### `remove alias`
|
|
893
|
+
|
|
894
|
+
Removes a specific alias from a location:
|
|
895
|
+
|
|
896
|
+
```bash
|
|
897
|
+
$ friends remove alias "New York City" "Big Apple"
|
|
898
|
+
Alias removed: "New York City (a.k.a. NYC)"
|
|
899
|
+
```
|
|
900
|
+
|
|
879
901
|
#### `rename friend`
|
|
880
902
|
|
|
881
903
|
```bash
|
|
@@ -956,7 +978,7 @@ If you have an idea,
|
|
|
956
978
|
[make a GitHub issue](https://github.com/JacobEvelyn/friends/issues/new)!
|
|
957
979
|
Suggestions are very very welcome, and usually are implemented very
|
|
958
980
|
quickly. And if you'd like to do the implementing yourself, see the
|
|
959
|
-
[contributing guide](https://github.com/JacobEvelyn/friends/blob/
|
|
981
|
+
[contributing guide](https://github.com/JacobEvelyn/friends/blob/main/.github/CONTRIBUTING.md).
|
|
960
982
|
|
|
961
983
|
A big big thanks to all of this project's lovely
|
|
962
984
|
[contributors](https://github.com/JacobEvelyn/friends/graphs/contributors):
|
|
@@ -988,10 +1010,10 @@ Support this project by becoming a sponsor. Your logo will show up here with a l
|
|
|
988
1010
|
|
|
989
1011
|
## Code of Conduct
|
|
990
1012
|
|
|
991
|
-
Note that this project follows a [Code of Conduct](https://github.com/JacobEvelyn/friends/blob/
|
|
1013
|
+
Note that this project follows a [Code of Conduct](https://github.com/JacobEvelyn/friends/blob/main/CODE_OF_CONDUCT.md).
|
|
992
1014
|
If you're a polite, reasonable person you won't have any issues!
|
|
993
1015
|
|
|
994
1016
|
## License
|
|
995
1017
|
|
|
996
1018
|
Friends is released under the
|
|
997
|
-
[MIT License](https://github.com/JacobEvelyn/friends/blob/
|
|
1019
|
+
[MIT License](https://github.com/JacobEvelyn/friends/blob/main/LICENSE.txt).
|
data/RELEASING.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
These are steps for the maintainer to take to release a new version of this gem.
|
|
4
4
|
|
|
5
|
-
1. On the `
|
|
5
|
+
1. On the `main` branch, update the `VERSION` constant in
|
|
6
6
|
`lib/friends/version.rb`.
|
|
7
7
|
2. Commit the change (`git add -A && git commit -m 'Bump to vX.X'`).
|
|
8
8
|
3. Add a tag (`git tag -am "vX.X" vX.X`).
|
data/bin/friends
CHANGED
|
@@ -12,7 +12,6 @@ end
|
|
|
12
12
|
require "gli"
|
|
13
13
|
require "paint"
|
|
14
14
|
require "readline"
|
|
15
|
-
require "semverse"
|
|
16
15
|
|
|
17
16
|
require "friends/introvert"
|
|
18
17
|
require "friends/version"
|
|
@@ -35,7 +34,7 @@ class Tag
|
|
|
35
34
|
# conversions for arguments.
|
|
36
35
|
# See: https://github.com/davetron5000/gli/issues/241
|
|
37
36
|
def self.convert_to_tag(str)
|
|
38
|
-
str = str.strip
|
|
37
|
+
str = str.to_s.strip
|
|
39
38
|
!str.empty? && str[0] == "@" ? str : "@#{str}"
|
|
40
39
|
end
|
|
41
40
|
end
|
|
@@ -48,10 +47,7 @@ class Stripped; end
|
|
|
48
47
|
accept(Stripped, &:strip)
|
|
49
48
|
|
|
50
49
|
class InputDate; end
|
|
51
|
-
accept(InputDate)
|
|
52
|
-
time = Chronic.parse(value)
|
|
53
|
-
time && time.to_date
|
|
54
|
-
end
|
|
50
|
+
accept(InputDate) { |value| Chronic.parse(value)&.to_date }
|
|
55
51
|
|
|
56
52
|
switch [:quiet],
|
|
57
53
|
negatable: false,
|
|
@@ -102,7 +98,7 @@ post do
|
|
|
102
98
|
rescue Errno::ENOENT
|
|
103
99
|
# If the pager is not installed, just print the output.
|
|
104
100
|
puts @introvert.output
|
|
105
|
-
rescue Errno::EPIPE
|
|
101
|
+
rescue Errno::EPIPE
|
|
106
102
|
# Occurs when quitting the pager.
|
|
107
103
|
end
|
|
108
104
|
end
|
data/friends.gemspec
CHANGED
|
@@ -23,17 +23,15 @@ Gem::Specification.new do |spec|
|
|
|
23
23
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
24
24
|
spec.require_paths = ["lib"]
|
|
25
25
|
|
|
26
|
-
# We need Ruby 2.
|
|
27
|
-
|
|
28
|
-
spec.required_ruby_version = ">= 2.1"
|
|
26
|
+
# We need Ruby 2.3's safe navigation operator.
|
|
27
|
+
spec.required_ruby_version = ">= 2.3"
|
|
29
28
|
|
|
30
29
|
spec.add_dependency "chronic", "~> 0.10"
|
|
31
30
|
spec.add_dependency "gli", "~> 2.14"
|
|
32
31
|
spec.add_dependency "paint", "~> 2.0"
|
|
33
|
-
spec.add_dependency "semverse", ">= 2", "< 4"
|
|
34
32
|
spec.add_dependency "tty-pager", "~> 0.11"
|
|
35
33
|
|
|
36
34
|
spec.add_development_dependency "minitest", "~> 5.5"
|
|
37
35
|
spec.add_development_dependency "minitest-proveit", "~> 1.0"
|
|
38
|
-
spec.add_development_dependency "rake", "~>
|
|
36
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
|
39
37
|
end
|
data/lib/friends/commands/add.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
desc "Adds a friend (or nickname), activity, note, or location"
|
|
3
|
+
desc "Adds a friend (or nickname), activity, note, or location (or alias)"
|
|
4
4
|
command :add do |add|
|
|
5
5
|
add.desc "Adds a friend"
|
|
6
6
|
add.arg_name "NAME"
|
|
@@ -35,7 +35,16 @@ command :add do |add|
|
|
|
35
35
|
add.arg_name "NAME NICKNAME"
|
|
36
36
|
add.command :nickname do |add_nickname|
|
|
37
37
|
add_nickname.action do |_, _, args|
|
|
38
|
-
@introvert.add_nickname(name: args.first.strip, nickname: args[1].strip)
|
|
38
|
+
@introvert.add_nickname(name: args.first.to_s.strip, nickname: args[1].to_s.strip)
|
|
39
|
+
@dirty = true # Mark the file for cleaning.
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
add.desc "Adds an alias to a location"
|
|
44
|
+
add.arg_name "LOCATION ALIAS"
|
|
45
|
+
add.command :alias do |add_alias|
|
|
46
|
+
add_alias.action do |_, _, args|
|
|
47
|
+
@introvert.add_alias(name: args.first.to_s.strip, nickname: args[1].to_s.strip)
|
|
39
48
|
@dirty = true # Mark the file for cleaning.
|
|
40
49
|
end
|
|
41
50
|
end
|
|
@@ -46,7 +55,7 @@ command :add do |add|
|
|
|
46
55
|
add_tag.action do |_, _, args|
|
|
47
56
|
@introvert.add_tag(
|
|
48
57
|
name: args[0..-2].join(" "),
|
|
49
|
-
tag: Tag.convert_to_tag(args.last.strip)
|
|
58
|
+
tag: Tag.convert_to_tag(args.last.to_s.strip)
|
|
50
59
|
)
|
|
51
60
|
@dirty = true # Mark the file for cleaning.
|
|
52
61
|
end
|
|
@@ -73,8 +73,11 @@ command :list do |list|
|
|
|
73
73
|
|
|
74
74
|
list.desc "List all locations"
|
|
75
75
|
list.command :locations do |list_locations|
|
|
76
|
-
list_locations.
|
|
77
|
-
|
|
76
|
+
list_locations.switch [:verbose],
|
|
77
|
+
negatable: false,
|
|
78
|
+
desc: "Output location aliases"
|
|
79
|
+
list_locations.action do |_, options|
|
|
80
|
+
@introvert.list_locations(verbose: options[:verbose])
|
|
78
81
|
end
|
|
79
82
|
end
|
|
80
83
|
|