cli_utils_plus 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/lib/cli_utils_plus/color.rb +16 -0
- data/lib/cli_utils_plus/logger.rb +11 -0
- data/lib/cli_utils_plus/prompt.rb +17 -0
- data/lib/cli_utils_plus/spinner.rb +27 -0
- data/lib/cli_utils_plus.rb +7 -0
- metadata +49 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 805bd7c62f542351513dc2b918891f5f11d7d346bf46d36c3be806e391f45d0f
|
|
4
|
+
data.tar.gz: 1a87fa996d6ae8e427f152af7128668d624317c0e936a0a14387196cb33208ab
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: f2ad75050c2088ef549f2fec486bfdcaa50a03079bff93ce70705b107ed481b437f912037644368c87d0223a60256e0520c48d81cd9926685d8911ad973e56f2
|
|
7
|
+
data.tar.gz: 161d0562c0f35ec7c4b467219018de6ba46fa38a7a8551397f07dda1c09388e3f82545108bf8b0d0177fcdf8f59266a56b72a24127929bcc6deec3217f7ea9cf
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module CLIUtilsPlus
|
|
2
|
+
module Prompt
|
|
3
|
+
def self.ask(message, default = nil)
|
|
4
|
+
print "#{message}"
|
|
5
|
+
print " [#{default}]" if default
|
|
6
|
+
print ": "
|
|
7
|
+
input = gets.strip
|
|
8
|
+
input.empty? && default ? default : input
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def self.confirm?(message)
|
|
12
|
+
print "#{message} (y/n): "
|
|
13
|
+
input = gets.strip.downcase
|
|
14
|
+
input == 'y'
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
module CLIUtilsPlus
|
|
2
|
+
class Spinner
|
|
3
|
+
FRAMES = %w[| / - \\]
|
|
4
|
+
|
|
5
|
+
def initialize(message = "Loading")
|
|
6
|
+
@message = message
|
|
7
|
+
@running = false
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def start
|
|
11
|
+
@running = true
|
|
12
|
+
Thread.new do
|
|
13
|
+
i = 0
|
|
14
|
+
while @running
|
|
15
|
+
print "\r#{@message} #{FRAMES[i % FRAMES.size]}"
|
|
16
|
+
sleep 0.1
|
|
17
|
+
i += 1
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def stop
|
|
23
|
+
@running = false
|
|
24
|
+
print "\r#{@message} done.\n"
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: cli_utils_plus
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Farz Bhullar
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2025-07-09 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: A simple utility gem for building beautiful and interactive CLI tools
|
|
14
|
+
in pure Ruby. Includes prompt, spinner, logger, and color helpers.
|
|
15
|
+
email:
|
|
16
|
+
- farz.bhullar@gmail.com
|
|
17
|
+
executables: []
|
|
18
|
+
extensions: []
|
|
19
|
+
extra_rdoc_files: []
|
|
20
|
+
files:
|
|
21
|
+
- lib/cli_utils_plus.rb
|
|
22
|
+
- lib/cli_utils_plus/color.rb
|
|
23
|
+
- lib/cli_utils_plus/logger.rb
|
|
24
|
+
- lib/cli_utils_plus/prompt.rb
|
|
25
|
+
- lib/cli_utils_plus/spinner.rb
|
|
26
|
+
homepage: https://github.com/farz-bhullar/cli_utils_plus
|
|
27
|
+
licenses:
|
|
28
|
+
- MIT
|
|
29
|
+
metadata: {}
|
|
30
|
+
post_install_message:
|
|
31
|
+
rdoc_options: []
|
|
32
|
+
require_paths:
|
|
33
|
+
- lib
|
|
34
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
35
|
+
requirements:
|
|
36
|
+
- - ">="
|
|
37
|
+
- !ruby/object:Gem::Version
|
|
38
|
+
version: '3.0'
|
|
39
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
40
|
+
requirements:
|
|
41
|
+
- - ">="
|
|
42
|
+
- !ruby/object:Gem::Version
|
|
43
|
+
version: '0'
|
|
44
|
+
requirements: []
|
|
45
|
+
rubygems_version: 3.4.19
|
|
46
|
+
signing_key:
|
|
47
|
+
specification_version: 4
|
|
48
|
+
summary: A lightweight Ruby gem with helpful CLI utility methods.
|
|
49
|
+
test_files: []
|