// Copyright (c) 2022, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'dart:async';

import 'package:args/args.dart';
import 'package:dds/devtools_server.dart';

const argDevToolsBuild = 'devtools-build';

void main(List<String> args) {
  final argParser = ArgParser()
    ..addOption(
      argDevToolsBuild,
      help: 'The location of the DevTools build to serve from DevTools server '
          '(e.g. --devtools-build=absolute/path/to/devtools/build).',
      mandatory: true,
    );

  try {
    final ArgResults argResults = argParser.parse(args);
    unawaited(
      DevToolsServer().serveDevTools(
        customDevToolsPath: argResults[argDevToolsBuild],
      ),
    );
  } on FormatException catch (e) {
    print(e.message);
    print('');
    print(argParser.usage);
  }
}

Add a script to serve a local DevTools build
Add a script to serve a local DevTools build

Change-Id: I499b45830bacf8899c5db8d776f7a6c3a47e53b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231362
Reviewed-by: Ben Konyi <67ffcaedcc3dc3d87dddb9627b72dd41756b31b1@google.com>
Commit-Queue: Ben Konyi <67ffcaedcc3dc3d87dddb9627b72dd41756b31b1@google.com>
Reviewed-by: Kenzie (Schmoll) Davisson <7294156c507c19d848723c5abf67fe40039705bb@google.com>
