terminal-file-picker 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -3
- data/lib/terminal-file-picker/file_browser_model.rb +2 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af483ed650624caf3dc074f752cf63a969826b3da2f86b340071adcc6bc2329b
|
4
|
+
data.tar.gz: 9e63b9d7878d86f96827b3fc4f267ba3e07fa81049c30a76d8c63b49dfad2e9f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8cd35ad0a76eba5eb98693d7360ad2f783efb2b1306ee2509f8850b9679fc54c25b6a3462d9cf3bdc27398b2b8c1d6ce0b972cf80e11b0e69f4b4c91a1cb609b
|
7
|
+
data.tar.gz: cf4fffc39d5e39ffcb8a8b8026f3de032e5a4487776afe732b957de5207838d705323c827a86242c86d42c8b0b9a4afff922506adeea034db2d13ab373304078
|
data/README.md
CHANGED
@@ -10,7 +10,7 @@ The gem is useful when your program needs to accept a file path as input and you
|
|
10
10
|
|
11
11
|
The gem does not rely on the Curses library and instead uses the [TTY toolkit](https://github.com/piotrmurach/tty), which has cross platform support and support for many types of terminals/terminal emulators. Therefore this gem should also have the same level of support.
|
12
12
|
|
13
|
-
|
13
|
+
## Installation
|
14
14
|
|
15
15
|
```rb
|
16
16
|
gem install 'terminal-file-picker'
|
@@ -22,9 +22,11 @@ or add it to your project's `Gemfile`:
|
|
22
22
|
gem 'terminal-file-picker'
|
23
23
|
```
|
24
24
|
|
25
|
-
|
25
|
+
## Simple Usage
|
26
26
|
|
27
27
|
```rb
|
28
|
+
require 'terminal-file-picker'
|
29
|
+
|
28
30
|
# Only required argument is the "root path". The user will
|
29
31
|
# start navigating from the root path once file picker is invoked.
|
30
32
|
# Root path can be either absolute or relative.
|
@@ -39,7 +41,7 @@ picker = FilePicker.new('.')
|
|
39
41
|
puts(picker.pick_file)
|
40
42
|
```
|
41
43
|
|
42
|
-
|
44
|
+
## Options
|
43
45
|
|
44
46
|
There are some options to customise the look and feel of the file picker (all options do have default values, so all are optional)
|
45
47
|
|
@@ -89,3 +91,9 @@ You can change the date and time format of date modified and time modified colum
|
|
89
91
|
```rb
|
90
92
|
FilePicker.new('.', date_format: '%d-%m-%Y', time_format: '%H.%m')
|
91
93
|
```
|
94
|
+
|
95
|
+
## Development
|
96
|
+
|
97
|
+
- Officially, this gem supports Ruby versions >= 2.0.0 and such a Ruby version should be used during development as well.
|
98
|
+
- Tests are written with [Rspec](https://github.com/rspec/rspec), version ~3.9. Run the tests on terminal with `rspec` in the project directory (need to install rspec first).
|
99
|
+
- [Rubocop](https://github.com/rubocop-hq/rubocop) version ~0.8.2 is used to check for use of best practices and standard styling. Run Rubocop on the terminal with `rubocop` in the project directory (need to install Rubocop first). Currently, there are a couple of failing Rubocop checks which will be fixed soon.
|
@@ -33,6 +33,8 @@ class FileBrowserModel
|
|
33
33
|
# Order files such that '.' and '..' come before
|
34
34
|
# all the other files.
|
35
35
|
def order_files(files)
|
36
|
+
# Pre-sort files.
|
37
|
+
files.sort!{|a,b| a[0]<=>b[0]}
|
36
38
|
# Put "." and ".." at the start
|
37
39
|
groups = files.group_by do |f|
|
38
40
|
if f.first == './' || f.first == '../'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: terminal-file-picker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ilkut Kutlar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pastel
|
@@ -132,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
132
|
- !ruby/object:Gem::Version
|
133
133
|
version: '0'
|
134
134
|
requirements: []
|
135
|
-
rubygems_version: 3.
|
135
|
+
rubygems_version: 3.3.5
|
136
136
|
signing_key:
|
137
137
|
specification_version: 4
|
138
138
|
summary: Interactive terminal file picker
|