Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature:- AUTO TAB completion of flags #1402

Open
aman29271 opened this issue Apr 1, 2020 · 35 comments
Open

Feature:- AUTO TAB completion of flags #1402

aman29271 opened this issue Apr 1, 2020 · 35 comments

Comments

@aman29271
Copy link
Contributor

Is your feature request related to a problem? Please describe.
when you type some cli flags and press TAB key. It doesn't autocomplete the flags. It should complete the flags automatically as per user input.

Describe the solution you'd like

I want the flags to autocomplete when i type some partial text of a flag just like in node REPL mode.
Describe alternatives you've considered

Additional context

@aman29271 aman29271 changed the title AUTOTAB completion of flags Feature:- AUTO TAB completion of flags Apr 1, 2020
@alexander-akait
Copy link
Member

Not sure it is possible, because completion is scope of bash/terminal

@snitin315
Copy link
Member

something like this may possible - omelette

@aman29271
Copy link
Contributor Author

I am trying to implement this with yargs completion

@anshumanv
Copy link
Member

anshumanv commented Apr 5, 2020

I am trying to implement this with yargs completion

We are moving away from yargs #1347, don't

@aman29271
Copy link
Contributor Author

@anshumanv any suggestions other than omelette

@jamesgeorge007
Copy link
Member

tabtab is another option.

@rishabh3112
Copy link
Member

We can't have it unless we move to new arg parser and start using flags from webpack core.

@webpack-bot
Copy link

This issue had no activity for at least half a year.

It's subject to automatic issue closing if there is no activity in the next 15 days.

@webpack-bot
Copy link

Issue was closed because of inactivity.

If you think this is still a valid issue, please file a new issue with additional information.

@webpack-bot
Copy link

This issue had no activity for at least half a year.

It's subject to automatic issue closing if there is no activity in the next 15 days.

@anshumanv
Copy link
Member

bump

@webpack-bot
Copy link

This issue had no activity for at least half a year.

It's subject to automatic issue closing if there is no activity in the next 15 days.

@alexander-akait
Copy link
Member

bump

@webpack-bot
Copy link

This issue had no activity for at least half a year.

It's subject to automatic issue closing if there is no activity in the next 15 days.

@webpack-bot
Copy link

Issue was closed because of inactivity.

If you think this is still a valid issue, please file a new issue with additional information.

@aialok
Copy link

aialok commented Oct 24, 2023

@snitin315 can I work on this issue or this issue is close due to inactivity ?

@snitin315
Copy link
Member

@aialok feel free to work on it.

@aialok
Copy link

aialok commented Oct 24, 2023

Hello @snitin315 sir ,
I have some doubt regarding webpack.
Is there any slack/discord channel where I can ask my doubts ?
Webpack is going to participate for GSOC 2024 or not ? and I really really want to work with webpack.
Can you please guide me how to get started with this ?

@evenstensberg
Copy link
Member

@evenstensberg
Copy link
Member

Relative: tj/commander.js#385 (comment)

@HyperDanisH
Copy link

Is the use of omelette good enough or tabtab be used?

@HyperDanisH
Copy link

@alexander-akait what can be the best way to get all the flags that are built in webpack-cli, according to you.

@alexander-akait
Copy link
Member

You can get them using commander API

@shadowspawn
Copy link

Expanding on the API which is available, some deeper detail.

A Command object has an options property which is an array of the options. There are two complications you might care about when looking for completions:

  • some of the options may be hidden, and should not be suggested
  • the built-in help option does not appear in the array, and you might want to suggest it

Both can be supported by hand fairly easily. Or you can optionally use the Help object to give you a list of the visible options for a command, which handles these two cases. e.g.

import { Command, Option } from 'commander';

const program = new Command();

program.option('-d, --debug', 'output extra debugging');
program.addOption(new Option('-s, --secret', 'internal use only').hideHelp());

console.log('options array');
console.log(program.options.map(o => o.flags));

console.log('visible options');
const helper = program.createHelp();
console.log(helper.visibleOptions(program).map(o => o.flags));
% node index.mjs
options array
[ '-d, --debug', '-s, --secret' ]
visible options
[ '-d, --debug', '-h, --help' ]

@HyperDanisH
Copy link

The type of approach sir @shadowspawn proposed definitely could have been a choice for solving this issue and if fact this approach is also being used in the CLI to get options for help command to output.

However, this approach has an issue in this case.

The webpack-cli when executed runs under the hood a method run() this method is build on top of CLI class and and is responsible to initialize any command that is asked for. The issue is when executeAutoComplete() (The function responsible for giving back autocomplete suggestions) is executed, there is no context of any command to this function and when run, console.log(this.program.commands) it just returns an empty array.

This needs to be fixed or we will have to take any other approach. I welcome any suggestions from community as it will definitely speed up the process.

@urizennnn
Copy link

@HyperDanisH please in which file/folder should this be added to?

@HyperDanisH
Copy link

@HyperDanisH please in which file/folder should this be added to?

What be added?

@urizennnn
Copy link

@HyperDanisH please in which file/folder should this be added to?

What be added?

The Auto-Tab completion feature

@HyperDanisH
Copy link

I think you need to check pr related to this issue that is draft I made.

@urizennnn
Copy link

urizennnn commented Mar 24, 2024

I think you need to check pr related to this issue that is draft I made.

Oh alright, I have seen it .

@HyperDanisH
Copy link

@urizennnn ask me on discord in case you have any query about this pr. I am willing to help.

@urizennnn
Copy link

@urizennnn ask me on discord in case you have any query about this pr. I am willing to help.

can i have the link please, because i am invested in this even if it's outside the scope of gsoc.

@HyperDanisH
Copy link

@urizennnn ask me on discord in case you have any query about this pr. I am willing to help.

can i have the link please, because i am invested in this even if it's outside the scope of gsoc.

If you are asking about mine discord then it's username is danisharora and if webpack team's then follow this url

@HyperDanisH
Copy link

The type of approach sir @shadowspawn proposed definitely could have been a choice for solving this issue and if fact this approach is also being used in the CLI to get options for help command to output.

However, this approach has an issue in this case.

The webpack-cli when executed runs under the hood a method run() this method is build on top of CLI class and and is responsible to initialize any command that is asked for. The issue is when executeAutoComplete() (The function responsible for giving back autocomplete suggestions) is executed, there is no context of any command to this function and when run, console.log(this.program.commands) it just returns an empty array.

This needs to be fixed or we will have to take any other approach. I welcome any suggestions from community as it will definitely speed up the process.

@alexander-akait sir I would apreciate your opinion before I proceed any further. What do you think about this?

@urizennnn
Copy link

@urizennnn ask me on discord in case you have any query about this pr. I am willing to help.

can i have the link please, because i am invested in this even if it's outside the scope of gsoc.

If you are asking about mine discord then it's username is danisharora and if webpack team's then follow this url

both aren't bad

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

13 participants