onepub-dev / dcli

An extensive library and tooling for building console/cli applications and scripts using the Dart programming language.
242 stars 28 forks source link

Does not like dashes in directory name #126

Closed bradyt closed 3 years ago

bradyt commented 3 years ago

I see the following issue if the directory name has dashes.

% mkdir test-dashes
% cd test-dashes
% dcli create test.dart
% ./test.dart
Error: Could not resolve the package 'dcli' in 'package:dcli/dcli.dart'.
test.dart:4:8: Error: Not found: 'package:dcli/dcli.dart'
import 'package:dcli/dcli.dart';
       ^
test.dart:50:16: Error: Type 'ArgParser' not found.
void showUsage(ArgParser parser) {
               ^^^^^^^^^
test.dart:16:18: Error: Method not found: 'ArgParser'.
  final parser = ArgParser();
                 ^^^^^^^^^
test.dart:29:5: Error: Method not found: 'Settings'.
    Settings().setVerbose(enabled: true);
    ^^^^^^^^
test.dart:33:14: Error: Method not found: 'red'.
    printerr(red('You must pass a prompt'));
             ^^^
test.dart:33:5: Error: Method not found: 'printerr'.
    printerr(red('You must pass a prompt'));
    ^^^^^^^^
test.dart:42:52: Error: Getter not found: 'Ask'.
    response = ask('$prompt:', validator: Ask.all([Ask.alpha, Ask.required]));
                                                   ^^^
test.dart:42:63: Error: Getter not found: 'Ask'.
    response = ask('$prompt:', validator: Ask.all([Ask.alpha, Ask.required]));
                                                              ^^^
test.dart:42:43: Error: Getter not found: 'Ask'.
    response = ask('$prompt:', validator: Ask.all([Ask.alpha, Ask.required]));
                                          ^^^

To fix, replace dashes with underscores in name in pubspec.yaml, then

% dart pub get
% ./test.dart

The desired behavior might be to automatically generate names with underscores, or to have a clearer error sooner.

% dcli version  
Dcli Version: 0.39.4, Located at: /Users/alice/.pub-cache/bin/dcli
bsutton commented 3 years ago

Fixed in 0.39.5