Skip to content

Arbitrary inputs mapped to placeholders #51

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

Open
IronSinew opened this issue Feb 1, 2025 · 3 comments
Open

Arbitrary inputs mapped to placeholders #51

IronSinew opened this issue Feb 1, 2025 · 3 comments

Comments

@IronSinew
Copy link
Contributor

With interactive mode, there is a ton of exciting opportunities here! I could see something being useful with being able to input arbitrary values to inject into the command, and even with typeahead prompts!

// config/solo.php

'Show Table' => Command::from('php artisan db:table :tablename')
    ->withInput('tablename', ['default', 'promptable', 'values'])
//->withInput('tablename', collect($schema->getTables())) -- could accept any Traversable
   ->lazy(),

I am super excited at the prospect of interactive mode and hope that we get more functionality exposed to us to leverage it more.

I do think I could follow the solo:make command to achieve what I want, but it could be nice to simplify that exposure a bit as well.

@aarondfrancis
Copy link
Collaborator

Interesting! So how would you see this working? You'd go to run the command and it'd ask you to pick one of those options?

@IronSinew
Copy link
Contributor Author

IronSinew commented Feb 1, 2025

Yes, I've been toying around with a concept to see if I can get it to work. Right now I'm taking the prompted input and then dropping it into the pending process command similar to your make command, however, it gets grumpy on the next loop and starts scrolling all over the place on interactive mode after I output the db:table {$input} -- but I'm having a ton of fun playing around with it!

Image

Image

After returning my initial call, interactive mode isn't as happy.

Image

Still learning more about prompts and how it all works, so I'm sure I'm missing something.

@IronSinew
Copy link
Contributor Author

After playing around with this more, it seems like other things seem to break in this way. However, if I clear the output and then restart the command again, it seems okay. I wonder if there is a way to auto-clear the tab on (re)start 🤔

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

No branches or pull requests

2 participants