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

Autocomplete for Dynamic CLI #126

Open
GouravSardana opened this issue Sep 30, 2021 · 14 comments
Open

Autocomplete for Dynamic CLI #126

GouravSardana opened this issue Sep 30, 2021 · 14 comments
Labels
Hacktoberfest This Issue Will be Consider Under Hacktoberfest 2021 Level3 New features, major bug fixing.

Comments

@GouravSardana
Copy link
Member

We need to autocomplete feature for dynamic to make it easier to use.

For example -
If I type dynamic in the terminal it will show a popup like --help, -post, -no

See this -

OnPaste 20210930-165426

For implementation of autocomplete in python refer to this - https://python-prompt-toolkit.readthedocs.io/en/master/

This issue is dependent upon #125 . Because to use autocomplete we need a different shell to make our changes visible. That shell can be created by xonsh.

The end goal should be similar to this -
endgoal

Credit for autocomplete and xosh - gitsome

@GouravSardana GouravSardana added Level3 New features, major bug fixing. hacktoberfest-accepted Good Work, Your Pull Request is Accepted for the Hacktoberfest labels Sep 30, 2021
@lainq
Copy link
Contributor

lainq commented Sep 30, 2021

Hmm, that would be a nice addon

@Siddhant-K-code Siddhant-K-code added Hacktoberfest This Issue Will be Consider Under Hacktoberfest 2021 and removed hacktoberfest-accepted Good Work, Your Pull Request is Accepted for the Hacktoberfest labels Oct 6, 2021
@kriptonian1
Copy link

Is it like what we have to fetch it from history

@GouravSardana
Copy link
Member Author

Nops. Not from the history. We have to make patterns according to what user is typing

@shivankar-p
Copy link
Contributor

@GouravSardana I would like to work on this as a GSSOC contributor.

@GouravSardana
Copy link
Member Author

Please go ahead @shivankar-p

@shivankar-p
Copy link
Contributor

@GouravSardana Instead of using xonsh shell. Won't it be a better idea if there is something like a dynamic-cli REPL or shell which gets activated by running some command in bash like dynamic. And users will enter related commands in the REPL. In this case we can customise autocompletion and all just using prompt_toolkit.
I'm not sure if this will have any disadvantages compared with current way of implementation?

@GouravSardana
Copy link
Member Author

Can you come up with a design for this before implementing?

@shivankar-p
Copy link
Contributor

Can you come up with a design for this before implementing?

I was planning to take input from the input stream/console for commands instead of getting them from command line. But the console is just in a formatted way like any other REPL. For this maybe I would need to add some new functions for auto-completion and add the input logic like we do while taking input in any other python program.

@shivankar-p
Copy link
Contributor

Screenshot from 2022-03-12 23-24-28
Screenshot from 2022-03-12 23-24-10
Design wise it would look this way. User gets to access this features of dynamic-cli once he enters dynamic-cli in command line

@GouravSardana
Copy link
Member Author

This looks good only. I have 2 concern :

  1. Do we get the history or the current folder ? Something like that
  2. Can we integrate in such a way if we type dynamic then only it’ll activate ?

@shivankar-p
Copy link
Contributor

shivankar-p commented Mar 12, 2022

This looks good only. I have 2 concern :

  1. Do we get the history or the current folder ? Something like that
  2. Can we integrate in such a way if we type dynamic then only it’ll activate ?
  1. Yes
    1 . I didn't get what you meant. But if you are asking about autocomplete based on previous queries that could be done for a single session(I meant till the time user exits the REPL). To remember the previous session's queries for autocomplete is what I was looking for(still not sure about how to implement this)

@GouravSardana
Copy link
Member Author

Got it. I mean we were creating sessions or not. I think it’s clear now. We don’t have to worry about the autocomplete after the session
Please go on and start integrating this first. Will figure it out a way

@shivankar-p
Copy link
Contributor

shivankar-p commented Mar 13, 2022

@GouravSardana I made a pull request. Can you review it? I still need to handle some options/commands properly.
Commands like -help, -file are not yet handled

@mridul45
Copy link

I would be happy to contribute to the project as I find my skills a good fit for the issue . As a GSSOC 23 member I humbly ask to allow me to contribute to the issue. I firmly believe that I can be a valuable asset.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Hacktoberfest This Issue Will be Consider Under Hacktoberfest 2021 Level3 New features, major bug fixing.
Projects
None yet
Development

No branches or pull requests

6 participants