lmki 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.
Files changed (5) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +19 -0
  3. data/README.md +34 -0
  4. data/bin/lmki +62 -0
  5. metadata +63 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 7bf2c798029fcd41d646f19754cf7ab325e6262d26cffc84f453ca7dbf0e8f81
4
+ data.tar.gz: 337507cf6ebf0376e1c1f35742af0ca84cafee31a815ae9537373276a0b68f31
5
+ SHA512:
6
+ metadata.gz: 7294936eb744dfe210b8faecb60eec61f551a765e964a412e39d698bce47a91706a7d0a8d1f0be3d32aaf709909ccff9959626987fd5adb5632b1dcedd8b53ec
7
+ data.tar.gz: b9fd64209af0d0dd0f60962079eb520398a2512a1e78daf066cd49a51ec20b25febefc43addc24926837f50c7468ca0e0b1dd6d24812fe513fa09f828f6ee044
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2018 Alfredo Ramírez
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
@@ -0,0 +1,34 @@
1
+ # LMKI - Let Me Know In
2
+
3
+ Provides a minimalist timer inside the command-line terminal and send a macOS notification when the time's up.
4
+
5
+ ## Installing
6
+
7
+ ```
8
+ $ gem install lmki
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ This library provides a command line application called `lmki`.
14
+
15
+ ```
16
+ lmki NUMBER[SUFFIX] MESSAGE
17
+ ```
18
+
19
+ After NUMBER amount of time sends a macOS notification with MESSAGE. SUFFIX may be "s" for seconds, "m" for minutes (the default), "h" for hours, or "d" for days.
20
+
21
+ ### Examples
22
+
23
+ ```
24
+ lkmi 5 'Please, check the eggs'
25
+ lkmi 25m 'Get away from the computer'
26
+ lkmi 1h 'Call the plumber'
27
+ ```
28
+
29
+ ## License
30
+
31
+ This project is shared under the MIT license. See the attached [LICENSE][] file
32
+ for details.
33
+
34
+ [LICENSE]: ./LICENSE
@@ -0,0 +1,62 @@
1
+ #!/usr/bin/env ruby
2
+ require 'terminal-notifier'
3
+
4
+ help = <<EOS
5
+ LMKI(1)
6
+
7
+ NAME
8
+ lmki -- Simple command-line timer for MacOS
9
+
10
+ SYNOPSIS
11
+
12
+ lmki NUMBER[SUFFIX] MESSAGE
13
+
14
+ DESCRIPTION
15
+ Provide a minimalist countdown timer inside your command-line terminal. Send a macOS notification with MESSAGE after NUMBER minutes.
16
+
17
+ SUFFIX may be "s" for seconds,
18
+ "m" for minutes (the default),
19
+ "h" for hours, or
20
+ "d" for days
21
+
22
+ EXAMPLE
23
+
24
+ lmki 5m 'Please, check the eggs.'
25
+
26
+ EOS
27
+
28
+ unless ARGV[0]
29
+ puts help
30
+ exit 1
31
+ end
32
+
33
+ case ARGV[0]
34
+ when "help" then puts help
35
+ else
36
+ period_input = ARGV[0].match(/\d+(s|m|h|d)?/)
37
+
38
+ unless period_input
39
+ STDERR.puts "Wrong amount of time"
40
+ exit 1
41
+ end
42
+
43
+ period = case period_input.captures.compact.first
44
+ when "s" then 1
45
+ when "h" then 3600 # 60 * 60
46
+ when "d" then 86400 # 60 * 60 * 24
47
+ else
48
+ 60
49
+ end
50
+
51
+ time = ARGV[0].to_f * period
52
+ message = ARGV[1] || "Hey! Time's up."
53
+
54
+ Process.daemon
55
+
56
+ sleep time
57
+
58
+ TerminalNotifier.notify(
59
+ message,
60
+ title: "lkmi",
61
+ )
62
+ end
metadata ADDED
@@ -0,0 +1,63 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lmki
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Alfredo Ramírez
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-03-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: terminal-notifier
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ description: Provides a minimalist timer inside the command-line terminal and send
28
+ a macOS notification when the time's up.
29
+ email:
30
+ - alfredormz@gmail.com
31
+ executables:
32
+ - lmki
33
+ extensions: []
34
+ extra_rdoc_files: []
35
+ files:
36
+ - LICENSE
37
+ - README.md
38
+ - bin/lmki
39
+ homepage: http://github.com/alfredormz/lmki
40
+ licenses:
41
+ - MIT
42
+ metadata: {}
43
+ post_install_message:
44
+ rdoc_options: []
45
+ require_paths:
46
+ - lib
47
+ required_ruby_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ requirements: []
58
+ rubyforge_project:
59
+ rubygems_version: 2.7.4
60
+ signing_key:
61
+ specification_version: 4
62
+ summary: Simple command-line timer for MacOS
63
+ test_files: []