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 Request) - Allow restish to be used in non-interactive mode #238

Open
thebauda opened this issue Feb 1, 2024 · 2 comments
Open
Labels
enhancement New feature or request

Comments

@thebauda
Copy link

thebauda commented Feb 1, 2024

Description

Rather than following command line prompts, allow restish to be used in a non-interactive mode where users can pass flags to streamline API configuration and modification.

Background

Our team uses restish to expose proprietary APIs through a CLI written in Golang. Behind the scenes, we configure APIs through restish and wrap the inputs and outputs to conform to our desired user experience. By having restish in a non-interactive format, it will streamline our API onboarding and reconfiguration process where we have to guess what output will be returned, as well as guess where the user's restish.json file is located so we don't have to modify it directly.

@danielgtaylor danielgtaylor added the enhancement New feature or request label Feb 2, 2024
loicalleyne pushed a commit to loicalleyne/restish that referenced this issue Apr 23, 2024
danielgtaylor#238

Pass in []string which replaces the os.Args[], io.Writers to optionally redirect Stdout and Stderr, and optionally pass in an authentication token override.
@loicalleyne
Copy link

loicalleyne commented Apr 24, 2024

I've submitted a pull request which adds an restish/embedded package that allows restish to be imported as a library.
It allows for setting a different appname (separate config from restish installed on system), sending an authorization token prefix and token in the function call (new handler added in cli/auth.go), and optionally passsing in io.Writers to redirect cli.Stdout and cli.Stderr.
I didn't write any tests for it but I got a branch of my fork working in another CLI app once I fixed the imports.
github.com/loicalleyne/restish@embedtest

@thebauda
Copy link
Author

thebauda commented May 7, 2024

Awesome, thank you!

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

No branches or pull requests

3 participants