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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 636af1123ad9f1e4a01854b9d5d22c228a3606b49b953c8f8b5bfd7e83bd59ac
4
- data.tar.gz: 0fd01831f754ba9fa4627c7de07ac061705535b2bdacf41407f974d73cf0f2af
3
+ metadata.gz: 03ad940e0f61e4ec12aa0a7e6ff3129032ab6f8a4b58b732a36cd6c37f733270
4
+ data.tar.gz: c4697eb80dcfde2842b315d86d7e01648be2f0728a7d10256e09da88711b9517
5
5
  SHA512:
6
- metadata.gz: 34d8e7b77e6678167986cf196354b3fae725968ce232d2952ddc1faaf65b4de992f4d44a623dcdcd12e9ce24175c9e212178c04bbe0bde246df20a2778c3ef10
7
- data.tar.gz: c2a8e4d2d6827238223281bcd5cd90a352155e4e3f109a05e345ba2db7c63412bfd55e75d026288b4d0abe7d1799e205ca447e76b41066c6c9b2778459443bec
6
+ metadata.gz: bad1f62287c1a86878545bd02a6777052de7c93ec6ad406597599a04c549d8edf6e7b5966cc2750a14307736fcad5e02cd7f160617aa7349459e24f3c3d7c818
7
+ data.tar.gz: 332763db0a964bc461701122b84bf82f71ea015317c982c7031690fb88a72f4f2d7bfb611ba9a79126c81ddc666e754e914d636de108dc5c0ad7ab519a0ae33a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tty-prompt-files (0.1.0)
4
+ tty-prompt-files (0.1.1)
5
5
  tty-prompt (~> 0.23.1)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -1,30 +1,30 @@
1
1
  # TTY::Prompt::Files
2
2
 
3
- TODO: Delete this and the text below, and describe your gem
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
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/tty/prompt/files`. To experiment with that code, run `bin/console` for an interactive prompt.
5
+ ## Note!
6
6
 
7
- ## Installation
7
+ Be careful to use library before first major version. It does not support backward compatibility.
8
8
 
9
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
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
- $ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
11
+ ```rb
12
+ prompt = TTY::Prompt.new
18
13
 
19
- ## Usage
14
+ prompt.select_element_from_file_system
15
+ ```
20
16
 
21
- TODO: Write usage instructions here
17
+ After element is selected, output will be a element full path.
22
18
 
23
- ## Development
19
+ `select_element_from_file_system` has 3 parameters:
24
20
 
25
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
21
+ ```rb
22
+ prompt.select_element_from_file_system(pattern: "*", path: ".", text: "")
23
+ ```
26
24
 
27
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
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
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module TTY
4
4
  module Files
5
- VERSION = "0.1.1"
5
+ VERSION = "0.1.2"
6
6
  end
7
7
  end
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 select_element_from_file_system(pattern: "*", path: ".", text: "", options: {})
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.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 00:00:00.000000000 Z
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