Shopify / cli-ui

CLI tooling framework with simple interactive widgets
MIT License
990 stars 50 forks source link

`is_file` option not working for `ask` #531

Open elliotcm opened 2 months ago

elliotcm commented 2 months ago

Hello. As far as I can tell, the is_file option for ask is not working, perhaps just on my local environment, but I'm not sure how to debug further.

I've created a minimal test, and confirmed that I can't tab complete either files in CWD or even starting with /

file_test.rb:

require "rubygems"
require "cli/ui"

file = CLI::UI.ask("A file question", is_file: true)
puts "File exists? #{File.exist?(file)}"

Some system/version information (I've [redacted] a few bits):

% gem list cli-ui
*** LOCAL GEMS ***

cli-ui (2.2.3)
% ruby -v
ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin23]
% asdf info
OS:
Darwin [machine-name] 23.1.0 Darwin Kernel Version 23.1.0: Mon Oct  9 21:28:45 PDT 2023; root:xnu-10002.41.9~6/RELEASE_ARM64_T6020 arm64

SHELL:
zsh 5.9 (x86_64-apple-darwin23.0)

BASH VERSION:
3.2.57(1)-release

ASDF VERSION:
v0.14.0

ASDF INTERNAL VARIABLES:
ASDF_DEFAULT_TOOL_VERSIONS_FILENAME=.tool-versions
ASDF_DATA_DIR=[~]/.asdf
ASDF_DIR=/opt/homebrew/opt/asdf/libexec
ASDF_CONFIG_FILE=[~]/.asdfrc

ASDF INSTALLED PLUGINS:
nodejs                       https://github.com/asdf-vm/asdf-nodejs.git master c5b7c40
ruby                         https://github.com/asdf-vm/asdf-ruby.git master 37e32d1
yarn                         https://github.com/twuni/asdf-yarn.git main 376c540

I don't know which readline asdf uses but this is the one I have installed from homebrew:

% brew info readline
==> readline: stable 8.2.10 (bottled) [keg-only]
Library for command-line editing
https://tiswww.case.edu/php/chet/readline/rltop.html
Installed
/opt/homebrew/Cellar/readline/8.2.10 (51 files, 1.7MB)
  Poured from bottle using the formulae.brew.sh API on 2024-06-13 at 09:09:30
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/r/readline.rb
donk-shopify commented 2 months ago

Reline.completion_proc in ./lib/cli/ui/prompt.rb appears to not function.