Replies: 2 comments 1 reply
-
I don't see no reason why A lot of influence for these are coming either from github cli(how go libs in it work) and on js side how https://github.com/SBoudrias/Inquirer.js. Inquirer has some extensions for picking paths so it's a great place to steal ideas. |
Beta Was this translation helpful? Give feedback.
-
@timtebeek had some comments in #497 as well. We could try add some hooks so that user is able to define things around path selection and how things are shown. Making it easy to pick proposed would be nice as it speeds up things without having a to type full path. |
Beta Was this translation helpful? Give feedback.
-
I have a use case where I actually want to use the PathInput as a way to select a directory.
For this I'd which to actually have the ability for "autocompletion" like it is available in most shells. I know this is something for which PathInput was probably not intended for (I mean it actually displays an Message with level ERROR if a directory exists.)
Since I think this might still be a valid usecase I'd advocate to switch the level to WARN. In addition if interested I'd like to try to implement a naive autocompletion. If I understood the API correctly there would be a new
OPERATION_AUTOCOMPLETE
which could be bound to some key press in the keyMap right (I'd bind it to tab).In the PathInput a possible autocomplete proposal would be computed. If no suitable proposal is found nothing would happen. I'd like to keep the proposal quite simple. For any input path get the parent and look if any of the child's start with the farthest element of the path.
Check if any children of
parent
start withsection
, if exactly one child starts with thesection
resolve to the found child.Example dir:
Case match:
Since there is exactly one child starting with
ba
we resolve to/tmp/backup
Case no-match:
Since there is multipe children starting with
log
(logs & log.txt) we don't resolve.Beta Was this translation helpful? Give feedback.
All reactions