Skip to content

Commit

Permalink
Uses internal instance
Browse files Browse the repository at this point in the history
  • Loading branch information
rk0cc committed Jan 10, 2024
1 parent e17f095 commit 3e2a20b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 0 additions & 5 deletions bin/oghref_cmd.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,8 @@ import 'package:oghref_cmd/src/cmds/current_version.dart';
import 'package:oghref_cmd/src/cmds/get_info.dart';
import 'package:oghref_cmd/src/cmds/get_media.dart';
import 'package:oghref_cmd/src/cmds/json_export.dart';
import 'package:oghref_model/model.dart';

Future<void> main(List<String> args) async {
MetaFetch.instance
..register(const OpenGraphPropertyParser())
..register(const TwitterCardPropertyParser());

CommandRunner<void> runner = CommandRunner("oghref_cmd",
"Command line tools for retriving rich information link in URL")
..addCommand(OgHrefGetInfoCommand())
Expand Down
6 changes: 5 additions & 1 deletion lib/src/cmds/abstract_getter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ abstract base class AbstractOgHrefGetterCommand extends Command<void> {
"twitter": "Fetch Twitter card metadata context"
};

static final MetaFetch _cmdFetchInstance = MetaFetch()
..register(const OpenGraphPropertyParser())
..register(const TwitterCardPropertyParser());

AbstractOgHrefGetterCommand() {
argParser
..addOption("protocol",
Expand Down Expand Up @@ -40,7 +44,7 @@ abstract base class AbstractOgHrefGetterCommand extends Command<void> {
stdout.write("Fetching data...");

try {
await MetaFetch.instance.fetchAllFromHttp(url).then((metas) {
await _cmdFetchInstance.fetchAllFromHttp(url).then((metas) {
stdout
..writeCharCode(13)
..write(List.filled(40, " ").join())
Expand Down

0 comments on commit 3e2a20b

Please sign in to comment.