tty-prompt-files 0.1.1 → 0.1.2
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/Gemfile.lock +1 -1
- data/README.md +16 -16
- data/lib/tty/files/version.rb +1 -1
- data/lib/tty/files.rb +1 -2
- data/lib/tty-prompt-files.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03ad940e0f61e4ec12aa0a7e6ff3129032ab6f8a4b58b732a36cd6c37f733270
|
4
|
+
data.tar.gz: c4697eb80dcfde2842b315d86d7e01648be2f0728a7d10256e09da88711b9517
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bad1f62287c1a86878545bd02a6777052de7c93ec6ad406597599a04c549d8edf6e7b5966cc2750a14307736fcad5e02cd7f160617aa7349459e24f3c3d7c818
|
7
|
+
data.tar.gz: 332763db0a964bc461701122b84bf82f71ea015317c982c7031690fb88a72f4f2d7bfb611ba9a79126c81ddc666e754e914d636de108dc5c0ad7ab519a0ae33a
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,30 +1,30 @@
|
|
1
1
|
# TTY::Prompt::Files
|
2
2
|
|
3
|
-
|
3
|
+
TTY-Prompt-files is extension for [tty-prompt](https://github.com/piotrmurach/tty-prompt) gem that allow interactive selection elements from file system and get absolute path.
|
4
4
|
|
5
|
-
|
5
|
+
## Note!
|
6
6
|
|
7
|
-
|
7
|
+
Be careful to use library before first major version. It does not support backward compatibility.
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
Install the gem and add to the application's Gemfile by executing:
|
12
|
-
|
13
|
-
$ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
|
14
|
-
|
15
|
-
If bundler is not being used to manage dependencies, install the gem by executing:
|
9
|
+
## Usage
|
16
10
|
|
17
|
-
|
11
|
+
```rb
|
12
|
+
prompt = TTY::Prompt.new
|
18
13
|
|
19
|
-
|
14
|
+
prompt.select_element_from_file_system
|
15
|
+
```
|
20
16
|
|
21
|
-
|
17
|
+
After element is selected, output will be a element full path.
|
22
18
|
|
23
|
-
|
19
|
+
`select_element_from_file_system` has 3 parameters:
|
24
20
|
|
25
|
-
|
21
|
+
```rb
|
22
|
+
prompt.select_element_from_file_system(pattern: "*", path: ".", text: "")
|
23
|
+
```
|
26
24
|
|
27
|
-
|
25
|
+
`pattern` is determining for what file will be output based on matching the pattern. If you want to display hidden files, use `"{.[^\.]*,*}"` pattern.\
|
26
|
+
`path` is determining path of the directory, can be relative or absolute. **Note**: relative **should not** end with `/`.\
|
27
|
+
`text` is text user will see along with elements.
|
28
28
|
|
29
29
|
## Contributing
|
30
30
|
|
data/lib/tty/files/version.rb
CHANGED
data/lib/tty/files.rb
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "files/version"
|
4
|
-
require "pry"
|
5
4
|
|
6
5
|
module TTY
|
7
6
|
class Prompt
|
8
|
-
def
|
7
|
+
def files(pattern: "*", path: ".", text: "", options: {})
|
9
8
|
pathnames = get_pathnames_from_path(pattern, path)
|
10
9
|
|
11
10
|
file_names = pathnames.map do |pathname|
|
@@ -0,0 +1 @@
|
|
1
|
+
require_relative 'tty/files'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tty-prompt-files
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Set27
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tty-prompt
|
@@ -39,6 +39,7 @@ files:
|
|
39
39
|
- LICENSE.txt
|
40
40
|
- README.md
|
41
41
|
- Rakefile
|
42
|
+
- lib/tty-prompt-files.rb
|
42
43
|
- lib/tty/files.rb
|
43
44
|
- lib/tty/files/version.rb
|
44
45
|
- sig/tty/prompt/files.rbs
|