printUsage function

void printUsage()

Prints the usage information and available commands for the Clonify CLI tool.

This function outputs a formatted help message to the console, detailing the general usage, a list of all available commands with their descriptions and aliases, and specific options that can be used with the configure and build commands. It also includes notes and examples for common use cases.

Implementation

void printUsage() {
  logger.i('Clonify CLI - A tool for managing Flutter app clones');
  logger.i('');
  logger.i('Usage: clonify <command> [options]');
  logger.i('');

  logger.i('Commands:');
  logger.i(
    '  create                                              Create a new clone.',
  );
  logger.i(
    '  configure | con | config | c [--clientId <id>]      Configure the app for the specified client ID.',
  );
  logger.i(
    '  clean | clear [--clientId <id>]                     Clean up a partial clone for the specified client ID.',
  );
  logger.i(
    '  build | b [--clientId <id>]                         Build the clone for the specified client ID.',
  );
  logger.i(
    '  upload | up | u [--clientId <id>]                   Upload the clone for the specified client ID.',
  );
  logger.i(
    '  list | ls                                           List all available clones.',
  );
  logger.i(
    '  which | current | who                               Get the current clone configuration.',
  );
  logger.i(
    '  help | -h | --help                                  Print this help message.',
  );
  logger.i('');

  logger.i('Options:');
  logger.i('  The following options can be used with specific commands:');
  logger.i('');

  logger.i('  For "configure" command:');
  logger.i(
    '    --clientId | -id <id>                             Specify the client ID for the command.',
  );
  logger.i(
    '    --skip-all | -SA                                  Skip all user prompts.',
  );
  logger.i(
    '    --auto-update | -AU                               Auto update the clone version.',
  );
  logger.i(
    '    --skip-firebase-configure | -SF                   Skip the Firebase configuration.',
  );
  logger.i(
    '    --skip-version | -SV                              Skip config file empty version check.',
  );
  logger.i(
    '    --skip-pub-update | -SPU                          Auto update pub version.',
  );
  logger.i(
    '    --skip-version-update | -SVU                      Skip the config version update prompt unless --auto-update is used.',
  );
  logger.i('');

  logger.i('  For "build" command:');
  logger.i(
    '    --clientId | -id <id>                             Specify the client ID for the command.',
  );
  logger.i(
    '    --skip-all | -SA                                  Skip all user prompts and build both Android and iOS clones.',
  );
  logger.i(
    '    --skip-build-check | -SBC                         Skip the confirmation check before building.',
  );
  logger.i(
    '    --upload-all | -UALL                              Build and upload both Android and iOS clones.',
  );
  logger.i(
    '    --upload-android | -UA                            Upload the Android clone after building.',
  );
  logger.i(
    '    --upload-ios | -UI                                Upload the iOS clone after building.',
  );
  logger.i('');

  logger.i('Note:');
  logger.i(
    '  - For commands that accept --clientId, if it is not provided, the last configured client ID will be used if available.',
  );
  logger.i(
    '  - Options can be combined, but some may conflict (e.g., --skip-all and --upload-all).',
  );
  logger.i('');

  logger.i('Examples:');
  logger.i('  clonify create');
  logger.i('  clonify configure --clientId <id> --skip-all');
  logger.i('  clonify clean --clientId <id>');
  logger.i('  clonify build --clientId <id> --skip-build-check');
  logger.i('  clonify upload --clientId <id> --upload-all');
  logger.i('  clonify list');
  logger.i('  clonify which');
}