Shopify / Shopify/cli-ui

`is_file` option not working for `ask`

Open
#531 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
1.1k
Forks
57
Avg merge
2h 55m
Merged PRs (30d)
2

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the minimal reproduction in file_test.rb and trace the CLI::UI.ask entry point when is_file is true. Reproduce the missing tab completion for files in the current directory and paths beginning with /; done means both cases complete as expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.