Skip to content

Only display prompts if connected to a terminal #771

Description

@oatovar

Is your feature request related to a problem? Please describe.

I'd like to use changie for automation, but prompts are always displayed without checking for interactivity. This makes it hard to use for automation purposes, and risks a never ending job if it runs in a CI/CD context.

Describe the solution you'd like

I'd like for changie to check for an active terminal before prompting.
If no terminal is connected, it should not prompt, and validate that it has enough data to create the changes. The golang.org/x/term package could be used to verify this.

Describe alternatives you've considered

It would also be helpful to have the ability to define null/empty values for custom data.

Additional context

I'm using changie as part of some dependency update automation. I'd like for every change submitted to include the kind and body. Due to some restrictions that are outside of my control, I'm unable to add the merge request ID until after the change has been merged.

To workaround this, I'm setting the MR custom data to 0, but this is brittle. If I want to add some additional custom data in the future, I have to go back and make sure our automation also adds the zero value when calling changie new. If not, the pipelines will stall waiting for human input.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions