Skip to content

Commit

Permalink
feat: colored help command
Browse files Browse the repository at this point in the history
  • Loading branch information
Yakiyo committed Jun 11, 2023
1 parent 42cdc73 commit 50560bb
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/src/util.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dart:io' show stderr, Platform, Directory, File;
import 'package:path/path.dart' show join;
import 'package:args/args.dart' show ArgParser;
import 'package:ansi/ansi.dart' show Ansi;
import '../tldart.dart';

/// Print debug logs. This should only print them if DEBUG env is non-empty
Expand All @@ -19,21 +20,22 @@ void eprint(dynamic error) {

/// Print help message
void showHelp(ArgParser parser) {
final ansi = Ansi();
print("""
tldart $version
${ansi.blue('tldart')} $version
Fast and easy to use TLDR client
USAGE:
tldr [OPTIONS] [COMMAND]
${ansi.blue("USAGE:")}
tldr ${ansi.blue("[OPTIONS]")} ${ansi.blue("[COMMAND]")}
Example: tldr -p linux git log
ARGUMENTS:
${ansi.blue("ARGUMENTS:")}
[COMMAND] The command to show (e.g. `cp` or `tar`)
OPTIONS:
${ansi.blue("OPTIONS:")}
${parser.usage.split("\n").join("\n ")}
To view documentation or file an issue, please visit https://github.com/Yakiyo/tldart
To view documentation or file an issue, please visit ${ansi.underline('https://github.com/Yakiyo/tldart')}
""");
return;
}
Expand Down

0 comments on commit 50560bb

Please sign in to comment.