Browse Source

Code formatting

main
Cédric Belin 4 months ago
parent
commit
a52034c9e6
22 changed files with 247 additions and 246 deletions
  1. +6
    -3
      .editorconfig
  2. +5
    -5
      .vscode/settings.json
  3. +1
    -1
      README.md
  4. +1
    -1
      analysis_options.yaml
  5. +31
    -31
      bin/open_cli.dart
  6. +0
    -5
      doc/about/see_also.md
  7. +4
    -4
      doc/index.md
  8. +8
    -8
      doc/installation.md
  9. +24
    -25
      doc/usage/api.md
  10. +4
    -4
      doc/usage/cli.md
  11. +9
    -5
      etc/mkdocs.yaml
  12. +13
    -13
      example/main.dart
  13. +1
    -1
      lib/open.dart
  14. +4
    -4
      lib/src/cli.dart
  15. +20
    -20
      lib/src/cli/options.dart
  16. +6
    -6
      lib/src/cli/usage.dart
  17. +5
    -5
      lib/src/io.dart
  18. +35
    -35
      lib/src/io/open.dart
  19. +37
    -37
      lib/src/io/platform.dart
  20. +1
    -1
      pubspec.yaml
  21. +29
    -29
      test/open_test.dart
  22. +3
    -3
      tool/clean.ps1

+ 6
- 3
.editorconfig View File

@@ -3,11 +3,14 @@ root = true

[*]
charset = utf-8
indent_size = 2
indent_style = space
indent_style = tab
insert_final_newline = true
tab_width = 2
trim_trailing_whitespace = true

[*.md]
indent_size = 4
trim_trailing_whitespace = false

[*.{yaml,yml}]
indent_size = 2
indent_style = space

+ 5
- 5
.vscode/settings.json View File

@@ -1,7 +1,7 @@
{
"editor.insertSpaces": true,
"editor.tabSize": 2,
"files.encoding": "utf8",
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true
"editor.insertSpaces": false,
"editor.tabSize": 2,
"files.encoding": "utf8",
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true
}

+ 1
- 1
README.md View File

@@ -1,5 +1,5 @@
# Open.dart
![Runtime](https://badgen.net/badge/dart/%3E%3D2.8.0/green) ![Release](https://img.shields.io/pub/v/open.svg) ![License](https://badgen.net/badge/license/MIT/blue)
![Runtime](https://badgen.net/pub/sdk-version/open) ![Release](https://badgen.net/pub/v/open) ![License](https://badgen.net/pub/license/open) ![Likes](https://badgen.net/pub/likes/open)

Open whatever you want in [Dart](https://dart.dev), such as URLs, files or executables, regardless of the platform you use.



+ 1
- 1
analysis_options.yaml View File

@@ -90,6 +90,7 @@ linter:
- prefer_const_literals_to_create_immutables
- prefer_constructors_over_static_methods
- prefer_contains
- prefer_double_quotes
- prefer_equal_for_default_values
- prefer_expression_function_bodies
- prefer_final_fields
@@ -112,7 +113,6 @@ linter:
- prefer_mixin
- prefer_null_aware_operators
- prefer_relative_imports
- prefer_single_quotes
- prefer_spread_collections
- prefer_typing_uninitialized_variables
- prefer_void_to_null


+ 31
- 31
bin/open_cli.dart View File

@@ -1,42 +1,42 @@
#!/usr/bin/env dart

// ignore_for_file: avoid_print
import 'dart:io';
import 'package:open/open.dart';
import 'package:open/src/cli.dart';
import 'package:open/src/version.dart';
import "dart:io";
import "package:open/open.dart";
import "package:open/src/cli.dart";
import "package:open/src/version.dart";

/// Application entry point.
Future<void> main(List<String> args) async {
// Parse the command line arguments.
Options options;
// Parse the command line arguments.
Options options;

try {
options = parseOptions(args);
if (options.help) return print(usage);
if (options.version) return print(packageVersion);
if (options.rest.isEmpty) throw const FormatException('A target must be provided.');
}
try {
options = parseOptions(args);
if (options.help) return print(usage);
if (options.version) return print(packageVersion);
if (options.rest.isEmpty) throw const FormatException("A target must be provided.");
}

on FormatException {
print(usage);
exitCode = 64;
return;
}
on FormatException {
print(usage);
exitCode = 64;
return;
}

// Run the program.
try {
await open(
options.rest.first,
application: options.application,
arguments: options.rest.skip(1),
background: options.background,
wait: options.wait
);
}
// Run the program.
try {
await open(
options.rest.first,
application: options.application,
arguments: options.rest.skip(1),
background: options.background,
wait: options.wait
);
}

on Exception catch (err) {
print(err);
exitCode = 1;
}
on Exception catch (err) {
print(err);
exitCode = 1;
}
}

+ 0
- 5
doc/about/see_also.md View File

@@ -1,9 +1,4 @@
# See also

## Development
- [API reference](https://api.belin.io/open.dart)
- [Pub package](https://pub.dev/packages/open)
- [Submit an issue](https://git.belin.io/cedx/open.dart/issues)

## Other implementations
- PHP: [Open.php](https://docs.belin.io/open.php)

+ 4
- 4
doc/index.md View File

@@ -1,19 +1,19 @@
# Open.dart
![Runtime](https://badgen.net/badge/dart/%3E%3D2.8.0/green) ![Release](https://img.shields.io/pub/v/open.svg) ![License](https://badgen.net/badge/license/MIT/blue)
![Runtime](https://badgen.net/pub/sdk-version/open) ![Release](https://badgen.net/pub/v/open) ![License](https://badgen.net/pub/license/open) ![Likes](https://badgen.net/pub/likes/open)

Open whatever you want in [Dart](https://dart.dev), such as URLs, files or executables, regardless of the platform you use.

## Quick start
Append the following line to your project's `pubspec.yaml` file:

```yaml
``` yaml
dependencies:
open: *
open: *
```

Install the latest version of **Open.dart** with [Pub](https://dart.dev/tools/pub):

```shell
``` shell
pub get
```



+ 8
- 8
doc/installation.md View File

@@ -6,7 +6,7 @@ and [Pub](https://dart.dev/tools/pub), the Dart package manager, up and running.

You can verify if you're already good to go with the following commands:

```shell
``` shell
dart --version
# Dart VM version: 2.8.1 (stable) (Thu Apr 30 09:25:21 2020 +0200) on "windows_x64"

@@ -15,31 +15,31 @@ pub --version
```

!!! info
If you plan to play with the package sources, you will also need
[PowerShell](https://docs.microsoft.com/en-us/powershell) and [Material for MkDocs](https://squidfunk.github.io/mkdocs-material).
If you plan to play with the package sources, you will also need
[PowerShell](https://docs.microsoft.com/en-us/powershell) and [Material for MkDocs](https://squidfunk.github.io/mkdocs-material).

## Installing with Pub package manager

### 1. Depend on it
Add this to your project's `pubspec.yaml` file:

```yaml
``` yaml
dependencies:
open: *
open: *
```

### 2. Install it
Install this package and its dependencies from a command prompt:

```shell
``` shell
pub get
```

### 3. Import it
Now in your [Dart](https://dart.dev) code, you can use:

```dart
import 'package:open/open.dart';
``` dart
import "package:open/open.dart";
```

See the [usage information](usage/api.md).

+ 24
- 25
doc/usage/api.md View File

@@ -6,25 +6,25 @@ source: lib/src/io/open.dart
# Application programming interface
This package provides a single function, `open()`, allowing to open a document or URL:

```dart
import 'package:open/open.dart';
``` dart
import "package:open/open.dart";

Future<void> main() async {
// Open a URL in the default browser.
await open('https://belin.io');
// Open a URL in the default browser.
await open("https://belin.io");

// Open a URL in the given browser.
await open('https://belin.io', application: 'firefox');
// Open a URL in the given browser.
await open("https://belin.io", application: "firefox");

// Open a URL in the given browser, using the specified arguments.
await open('https://belin.io',
application: 'chrome',
arguments: ['--incognito']
);
// Open a URL in the given browser, using the specified arguments.
await open("https://belin.io",
application: "chrome",
arguments: ["--incognito"]
);

// Open an image in the default viewer
// and wait for the opened application to quit.
await open('funny.gif', wait: true);
// Open an image in the default viewer
// and wait for the opened application to quit.
await open("funny.gif", wait: true);
}
```

@@ -32,8 +32,7 @@ The function returns a [`Future`](https://api.dart.dev/stable/dart-async/Future-
You would normally not need to use this for anything, but it can be useful if you'd like to perform operations directly on the spawned process.

!!! info
The function uses the command `start` on Windows, `open` on macOS
and `xdg-open` on other platforms.
The function uses the command `start` on Windows, `open` on macOS and `xdg-open` on other platforms.

## Options
The behavior of the `open()` function can be customized using the following optional named parameters.
@@ -45,30 +44,30 @@ The application name is platform dependent. For example, Goole Chrome is `chrome

You may also pass in the application's full path. For example on Windows Subsystem for Linux, this can be `"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"`.

```dart
await open('https://belin.io', application: 'firefox');
``` dart
await open("https://belin.io", application: "firefox");
```

### List&lt;String&gt; **arguments**
Specify the arguments to pass when using a custom `application` option.

```dart
await open('https://belin.io', application: 'chrome', arguments: ['--incognito']);
``` dart
await open("https://belin.io", application: "chrome", arguments: ["--incognito"]);
```

### bool **background**
Do not bring the application to the foreground (macOS only).

```dart
await open('spreadsheet.xlsx', background: true);
``` dart
await open("spreadsheet.xlsx", background: true);
```

### bool **wait**
Wait for the opened application to exit before completing the `Future`. If `false`, it's completed immediately after opening the application.

```dart
await open('funny.gif', wait: true);
``` dart
await open("funny.gif", wait: true);
```

!!! tip
On Windows, you have to explicitly specify the `application` option for it to be able to wait.
On Windows, you have to explicitly specify the `application` option for it to be able to wait.

+ 4
- 4
doc/usage/cli.md View File

@@ -6,15 +6,15 @@ source: lib/src/cli/options.dart
# Command line interface
From a command prompt, install the `open_cli` executable:

```shell
``` shell
pub global activate open
```
!!! tip
Consider adding the [`pub global`](https://dart.dev/tools/pub/cmd/pub-global) executables directory to your system path.
Consider adding the [`pub global`](https://dart.dev/tools/pub/cmd/pub-global) executables directory to your system path.

Then use it to open a document or URL:

```shell
``` shell
$ open_cli --help

Open whatever you want, such as URLs, files or executables, regardless of the platform you use.
@@ -31,7 +31,7 @@ Options:

For example:

```shell
``` shell
# Open a URL in the default browser.
open_cli https://belin.io



+ 9
- 5
etc/mkdocs.yaml View File

@@ -8,19 +8,23 @@ site_dir: ../www

repo_name: git.belin.io
repo_url: https://git.belin.io/cedx/open.dart
edit_uri: ''
edit_uri: ""

copyright: Copyright &copy; 2019 - 2020 Cédric Belin
extra:
social:
- icon: fontawesome/solid/globe
link: 'https://belin.io'
link: "https://belin.io"
name: Belin.io
- icon: fontawesome/brands/github
link: 'https://github.com/cedx'
link: "https://github.com/cedx"
name: GitHub
- icon: fontawesome/brands/twitter
link: 'https://twitter.com/cedxbelin'
link: "https://twitter.com/cedxbelin"
name: Twitter
- icon: fontawesome/brands/linkedin
link: 'https://linkedin.com/in/cedxbelin'
link: "https://linkedin.com/in/cedxbelin"
name: LinkedIn

markdown_extensions:
- admonition


+ 13
- 13
example/main.dart View File

@@ -1,20 +1,20 @@
import 'package:open/open.dart';
import "package:open/open.dart";

/// Demonstrates the usage of the `open()` function.
Future<void> main() async {
// Open a URL in the default browser.
await open('https://belin.io');
// Open a URL in the default browser.
await open("https://belin.io");

// Open a URL in the given browser.
await open('https://belin.io', application: 'firefox');
// Open a URL in the given browser.
await open("https://belin.io", application: "firefox");

// Open a URL in the given browser, using the specified arguments.
await open('https://belin.io',
application: 'chrome',
arguments: ['--incognito']
);
// Open a URL in the given browser, using the specified arguments.
await open("https://belin.io",
application: "chrome",
arguments: ["--incognito"]
);

// Open an image in the default viewer
// and wait for the opened application to quit.
await open('funny.gif', wait: true);
// Open an image in the default viewer
// and wait for the opened application to quit.
await open("funny.gif", wait: true);
}

+ 1
- 1
lib/open.dart View File

@@ -1,4 +1,4 @@
/// Open whatever you want, such as URLs, files or executables, regardless of the platform you use.
library open;

export 'src/io.dart';
export "src/io.dart";

+ 4
- 4
lib/src/cli.dart View File

@@ -1,11 +1,11 @@
/// Provides the command line interface.
library open.cli;

import 'package:build_cli_annotations/build_cli_annotations.dart';
import "package:build_cli_annotations/build_cli_annotations.dart";

part 'cli.g.dart';
part 'cli/options.dart';
part 'cli/usage.dart';
part "cli.g.dart";
part "cli/options.dart";
part "cli/usage.dart";

/// The command line argument parser.
ArgParser get argParser => _$parserForOptions;

+ 20
- 20
lib/src/cli/options.dart View File

@@ -1,32 +1,32 @@
part of '../cli.dart';
part of "../cli.dart";

/// The parsed command line arguments.
@CliOptions()
class Options {

/// Creates a new options object.
Options({this.application, this.background, this.help, this.rest, this.version, this.wait});
/// Creates a new options object.
Options({this.application, this.background, this.help, this.rest, this.version, this.wait});

/// The application to open the target with.
@CliOption(abbr: 'a', help: 'The application to open the target with.')
final String application;
/// The application to open the target with.
@CliOption(abbr: "a", help: "The application to open the target with.")
final String application;

/// Value indicating whether to not bring the app to the foreground (macOS only).
@CliOption(abbr: 'b', help: 'Do not bring the application to the foreground (macOS only).', negatable: false)
final bool background;
/// Value indicating whether to not bring the app to the foreground (macOS only).
@CliOption(abbr: "b", help: "Do not bring the application to the foreground (macOS only).", negatable: false)
final bool background;

/// Value indicating whether to output usage information.
@CliOption(abbr: 'h', help: 'Output usage information.', negatable: false)
final bool help;
/// Value indicating whether to output usage information.
@CliOption(abbr: "h", help: "Output usage information.", negatable: false)
final bool help;

/// The remaining command-line arguments that were not parsed as options or flags.
final List<String> rest;
/// The remaining command-line arguments that were not parsed as options or flags.
final List<String> rest;

/// Value indicating whether to output the version number.
@CliOption(abbr: 'v', help: 'Output the version number.', negatable: false)
final bool version;
/// Value indicating whether to output the version number.
@CliOption(abbr: "v", help: "Output the version number.", negatable: false)
final bool version;

/// Value indicating whether to wait for the opened application to exit.
@CliOption(abbr: 'w', help: 'Wait for the opened application to exit.', negatable: false)
final bool wait;
/// Value indicating whether to wait for the opened application to exit.
@CliOption(abbr: "w", help: "Wait for the opened application to exit.", negatable: false)
final bool wait;
}

+ 6
- 6
lib/src/cli/usage.dart View File

@@ -1,9 +1,9 @@
part of '../cli.dart';
part of "../cli.dart";

/// The usage information.
final String usage = (StringBuffer()
..writeln('Open whatever you want, such as URLs, files or executables, regardless of the platform you use.')..writeln()
..writeln('Usage: open_cli [options] <target> [-- <arguments>]')..writeln()
..writeln('Options:')
..write(argParser.usage))
.toString();
..writeln("Open whatever you want, such as URLs, files or executables, regardless of the platform you use.")..writeln()
..writeln("Usage: open_cli [options] <target> [-- <arguments>]")..writeln()
..writeln("Options:")
..write(argParser.usage))
.toString();

+ 5
- 5
lib/src/io.dart View File

@@ -1,9 +1,9 @@
/// Provides the I/O support.
library open.io;

import 'dart:async';
import 'dart:io' as io;
import 'dart:isolate';
import "dart:async";
import "dart:io" as io;
import "dart:isolate";

part 'io/open.dart';
part 'io/platform.dart';
part "io/open.dart";
part "io/platform.dart";

+ 35
- 35
lib/src/io/open.dart View File

@@ -1,43 +1,43 @@
part of '../io.dart';
part of "../io.dart";

/// Opens the specified [target].
/// Returns the spawned child process.
Future<io.Process> open(String target, {String application, Iterable<String> arguments, bool background = false, bool wait = false}) async {
assert(target.isNotEmpty);
assert(target.isNotEmpty);

String command;
final commandArgs = <String>[];
final isWsl = await Platform.isWindowsSubsystemForLinux;
var mode = io.ProcessStartMode.normal;
String command;
final commandArgs = <String>[];
final isWsl = await Platform.isWindowsSubsystemForLinux;
var mode = io.ProcessStartMode.normal;

if (io.Platform.isMacOS) {
command = 'open';
if (wait) commandArgs.add('--wait-apps');
if (background) commandArgs.add('--background');
if (application != null) commandArgs..add('-a')..add(application);
commandArgs.add(target);
if (arguments != null) commandArgs..add('--args')..addAll(arguments);
}
else if (io.Platform.isWindows || isWsl) {
command = 'cmd.exe';
commandArgs.addAll(['/c', 'start', '', '/b']);
if (wait) commandArgs.add('/wait');
if (application != null) commandArgs.add(isWsl && application.startsWith('/mnt/') ? await Platform.resolveWslPath(application) : application);
if (arguments != null) commandArgs.addAll(arguments);
commandArgs.add(target.replaceAll('&', '^&'));
}
else {
final packageUri = await Isolate.resolvePackageUri(Uri.parse('package:open/'));
command = application ?? (!io.Platform.isAndroid && !io.Platform.isIOS ? packageUri.resolve('../bin/xdg-open').toFilePath() : 'xdg-open');
if (arguments != null) commandArgs.addAll(arguments);
if (!wait) mode = io.ProcessStartMode.detached;
commandArgs.add(target);
}
if (io.Platform.isMacOS) {
command = "open";
if (wait) commandArgs.add("--wait-apps");
if (background) commandArgs.add("--background");
if (application != null) commandArgs..add("-a")..add(application);
commandArgs.add(target);
if (arguments != null) commandArgs..add("--args")..addAll(arguments);
}
else if (io.Platform.isWindows || isWsl) {
command = "cmd.exe";
commandArgs.addAll(["/c", "start", "", "/b"]);
if (wait) commandArgs.add("/wait");
if (application != null) commandArgs.add(isWsl && application.startsWith("/mnt/") ? await Platform.resolveWslPath(application) : application);
if (arguments != null) commandArgs.addAll(arguments);
commandArgs.add(target.replaceAll("&", "^&"));
}
else {
final packageUri = await Isolate.resolvePackageUri(Uri.parse("package:open/"));
command = application ?? (!io.Platform.isAndroid && !io.Platform.isIOS ? packageUri.resolve("../bin/xdg-open").toFilePath() : "xdg-open");
if (arguments != null) commandArgs.addAll(arguments);
if (!wait) mode = io.ProcessStartMode.detached;
commandArgs.add(target);
}

final process = await io.Process.start(command, commandArgs, mode: mode);
return !wait ? process : Future(() async {
final exitCode = await process.exitCode;
if (exitCode != 0) throw io.ProcessException(command, commandArgs, 'Exited with code $exitCode.');
return process;
});
final process = await io.Process.start(command, commandArgs, mode: mode);
return !wait ? process : Future(() async {
final exitCode = await process.exitCode;
if (exitCode != 0) throw io.ProcessException(command, commandArgs, "Exited with code $exitCode.");
return process;
});
}

+ 37
- 37
lib/src/io/platform.dart View File

@@ -1,43 +1,43 @@
// ignore_for_file: avoid_classes_with_only_static_members
part of '../io.dart';
part of "../io.dart";

/// Information about the environment in which the current program is running.
abstract class Platform {

/// Value indicating whether the process is running inside Docker.
static bool _isDocker;
/// Value indicating whether the process is running inside Windows Subsystem for Linux.
static bool _isWindowsSubsystemForLinux;
/// Value indicating whether the process is running inside Docker.
static Future<bool> get isDocker async {
if (_isDocker == null) {
if (io.File('/.dockerenv').existsSync()) _isDocker = true;
else
try { _isDocker = (await io.File('/proc/self/cgroup').readAsString()).contains('docker'); }
on io.FileSystemException { _isDocker = false; }
}
return _isDocker;
}
/// Value indicating whether the process is running inside Windows Subsystem for Linux.
static Future<bool> get isWindowsSubsystemForLinux async {
if (_isWindowsSubsystemForLinux == null) {
if (!io.Platform.isLinux) _isWindowsSubsystemForLinux = false;
else if (io.Platform.operatingSystemVersion.toLowerCase().contains('microsoft')) _isWindowsSubsystemForLinux = !(await isDocker);
else
try { _isWindowsSubsystemForLinux = (await io.File('/proc/version').readAsString()).toLowerCase().contains('microsoft') && !(await isDocker); }
on io.FileSystemException { _isWindowsSubsystemForLinux = false; }
}
return _isWindowsSubsystemForLinux;
}
/// Resolves the specified WSL [path] to a Windows path.
static Future<String> resolveWslPath(String path) async {
assert(path.isNotEmpty);
return (await io.Process.run('wslpath', ['-w', path])).stdout.trim();
}
/// Value indicating whether the process is running inside Docker.
static bool _isDocker;
/// Value indicating whether the process is running inside Windows Subsystem for Linux.
static bool _isWindowsSubsystemForLinux;
/// Value indicating whether the process is running inside Docker.
static Future<bool> get isDocker async {
if (_isDocker == null) {
if (io.File("/.dockerenv").existsSync()) _isDocker = true;
else
try { _isDocker = (await io.File("/proc/self/cgroup").readAsString()).contains("docker"); }
on io.FileSystemException { _isDocker = false; }
}
return _isDocker;
}
/// Value indicating whether the process is running inside Windows Subsystem for Linux.
static Future<bool> get isWindowsSubsystemForLinux async {
if (_isWindowsSubsystemForLinux == null) {
if (!io.Platform.isLinux) _isWindowsSubsystemForLinux = false;
else if (io.Platform.operatingSystemVersion.toLowerCase().contains("microsoft")) _isWindowsSubsystemForLinux = !(await isDocker);
else
try { _isWindowsSubsystemForLinux = (await io.File("/proc/version").readAsString()).toLowerCase().contains("microsoft") && !(await isDocker); }
on io.FileSystemException { _isWindowsSubsystemForLinux = false; }
}
return _isWindowsSubsystemForLinux;
}
/// Resolves the specified WSL [path] to a Windows path.
static Future<String> resolveWslPath(String path) async {
assert(path.isNotEmpty);
return (await io.Process.run("wslpath", ["-w", path])).stdout.trim();
}
}

+ 1
- 1
pubspec.yaml View File

@@ -7,7 +7,7 @@ issue_tracker: https://git.belin.io/cedx/open.dart/issues
repository: https://git.belin.io/cedx/open.dart

environment:
sdk: '>=2.8.0 <3.0.0'
sdk: ">=2.8.0 <3.0.0"

executables:
open_cli: open_cli


+ 29
- 29
test/open_test.dart View File

@@ -1,40 +1,40 @@
import 'dart:io' as io;
import 'package:open/open.dart';
import 'package:test/test.dart';
import "dart:io" as io;
import "package:open/open.dart";
import "package:test/test.dart";

/// Tests the features of the [open] function.
void main() => group('open()', () {
final googleChrome = io.Platform.isMacOS ? 'google chrome' : (io.Platform.isWindows ? 'chrome' : 'google-chrome');
const googleChromeWsl = '/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe';
void main() => group("open()", () {
final googleChrome = io.Platform.isMacOS ? "google chrome" : (io.Platform.isWindows ? "chrome" : "google-chrome");
const googleChromeWsl = "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe";

bool isWsl;
setUpAll(() async => isWsl ??= await Platform.isWindowsSubsystemForLinux);
bool isWsl;
setUpAll(() async => isWsl ??= await Platform.isWindowsSubsystemForLinux);

test('should open files in the default application', () async {
await open('test/open_test.dart');
});
test("should open files in the default application", () async {
await open("test/open_test.dart");
});

test('should open URLs in the default application', () async {
await open('https://belin.io');
});
test("should open URLs in the default application", () async {
await open("https://belin.io");
});

test('should open URLs in the given application', () async {
await open('https://belin.io', application: 'firefox');
});
test("should open URLs in the given application", () async {
await open("https://belin.io", application: "firefox");
});

test('should open URLs in the given application with arguments', () async {
await open('https://belin.io', application: googleChrome, arguments: ['--incognito']);
});
test("should open URLs in the given application with arguments", () async {
await open("https://belin.io", application: googleChrome, arguments: ["--incognito"]);
});

test('should wait for the given application to close', () async {
await open('https://belin.io', application: googleChrome, wait: true);
}, timeout: Timeout.none);
test("should wait for the given application to close", () async {
await open("https://belin.io", application: googleChrome, wait: true);
}, timeout: Timeout.none);

test('should open URLs in the specified application by using a given WSL path', () async {
if (isWsl) await open('https://belin.io', application: googleChromeWsl);
});
test("should open URLs in the specified application by using a given WSL path", () async {
if (isWsl) await open("https://belin.io", application: googleChromeWsl);
});

test('should open URLs in the specified application with arguments by using a given WSL path', () async {
if (isWsl) await open('https://belin.io', application: googleChromeWsl, arguments: ['--incognito']);
});
test("should open URLs in the specified application with arguments by using a given WSL path", () async {
if (isWsl) await open("https://belin.io", application: googleChromeWsl, arguments: ["--incognito"]);
});
});

+ 3
- 3
tool/clean.ps1 View File

@@ -2,10 +2,10 @@
Set-StrictMode -Version Latest
Set-Location (Split-Path $PSScriptRoot)

foreach ($item in '.dart_tool/build', 'build', 'doc/api', 'www') {
if (Test-Path $item) { Remove-Item $item -Recurse }
foreach ($item in ".dart_tool/build", "build", "doc/api", "www") {
if (Test-Path $item) { Remove-Item $item -Recurse }
}

foreach ($item in Get-ChildItem var -Exclude .gitkeep) {
Remove-Item $item -Recurse
Remove-Item $item -Recurse
}

Loading…
Cancel
Save