Skip to main content

gg_interact 0.1.0 copy "gg_interact: ^0.1.0" to clipboard
gg_interact: ^0.1.0 copied to clipboard

Interactive terminal prompts for the gg suite - select, input and confirm, with headless detection.

example/gg_interact_example.dart

#!/usr/bin/env dart

// @license
// Copyright (c) ggsuite
//
// Use of this source code is governed by terms that can be
// found in the LICENSE file in the root of this package.

import 'package:gg_interact/gg_interact.dart';

Future<void> main() async {
  throwWhenNotATerminal('the example prompts', 'run the example in a terminal');

  final prompts = GgPrompts.current;

  final language = await prompts.select(
    prompt: 'Which language?',
    options: ['Dart', 'TypeScript'],
  );

  final name = await prompts.inputUntilValid(
    prompt: 'Name',
    validate: (answer) => answer.isEmpty ? 'Please enter a name.' : null,
    onInvalid: print,
  );

  final ok = await prompts.confirm(prompt: 'Create $name?');
  print('language: $language, name: $name, create: $ok');
}
0
likes
160
points
105
downloads

Documentation

API reference

Publisher

verified publisherinlavigo.com

Weekly Downloads

Interactive terminal prompts for the gg suite - select, input and confirm, with headless detection.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

gg_console_colors, interact

More

Packages that depend on gg_interact