Skip to content

🤫 DisableInteraction

Disables Composer's interactive prompts. Equivalent to setting COMPOSER_NO_INTERACTION=1, causing all commands to run non-interactively.

When to use

Use it when running Composer in CI/CD pipelines, containers, or unattended scripts to prevent commands from hanging while waiting for user input.

Signature

go
func DisableInteraction() error

Parameters

This method takes no parameters.

Return value

Return valueTypeDescription
Single return valueerrorReturned on failure (usually nil)

Example

go
package main

import (
	"log"

	"github.com/scagogogo/composer-skills/pkg/composer"
)

func main() {
	if err := composer.DisableInteraction(); err != nil {
		log.Fatalf("failed to disable interaction: %v", err)
	}
	// All subsequent Composer commands will not trigger interactive prompts
}

Advanced

  • To re-enable interaction, use EnableInteraction().
  • Under the hood this function sets EnvComposerNoInteraction; it can also be done via SetEnvVariable.
  • Command-level non-interactive mode can also be achieved by passing --no-interaction to Run.

Released under the MIT License