Skip to content

Commit cc2d86e

Browse files
committed
update
1 parent 2b73565 commit cc2d86e

File tree

3 files changed

+26
-30
lines changed

3 files changed

+26
-30
lines changed

lib/src/gen_indexes.dart

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Future<void> genIndexes(
4646

4747
final help = argResults.flag(DefaultFlags.HELP.name);
4848
if (help) {
49-
_print(Glog.printCyan, parser.getInfo(argParser));
49+
_print(Log.printCyan, parser.getInfo(argParser));
5050
exit(ExitCodes.SUCCESS.code);
5151
}
5252

@@ -59,7 +59,7 @@ Future<void> genIndexes(
5959
templates = argResults.multiOption(DefaultMultiOptions.TEMPLATES.name);
6060
} catch (_) {
6161
_print(
62-
Glog.printRed,
62+
Log.printRed,
6363
'Missing required args! Use --help flag for more information.',
6464
);
6565
exit(ExitCodes.FAILURE.code);
@@ -72,7 +72,7 @@ Future<void> genIndexes(
7272

7373
// ---------------------------------------------------------------------------
7474

75-
_print(Glog.printWhite, 'Looking for files..');
75+
_print(Log.printWhite, 'Looking for files..');
7676
final filePathStream0 = PathExplorer(inputPath).exploreFiles();
7777
final filePathStream1 = filePathStream0.where((e) {
7878
final path = p.relative(e.path, from: inputPath);
@@ -82,35 +82,33 @@ Future<void> genIndexes(
8282
try {
8383
findings = await filePathStream1.toList();
8484
} catch (e) {
85-
_print(Glog.printRed, 'Failed to read file tree!', spinner);
85+
_print(Log.printRed, 'Failed to read file tree!', spinner);
8686
exit(ExitCodes.FAILURE.code);
8787
}
8888
if (findings.isEmpty) {
8989
spinner.stop();
90-
_print(Glog.printYellow, 'No files found in $inputPath!');
90+
_print(Log.printYellow, 'No files found in $inputPath!');
9191
exit(ExitCodes.SUCCESS.code);
9292
}
9393

9494
// ---------------------------------------------------------------------------
9595

9696
final templateData = <String, String>{};
9797
for (final template in templates) {
98-
_print(Glog.printWhite, 'Reading template at: $template...');
99-
final result = await MdTemplateUtility.i
100-
.readTemplateFromPathOrUrl(template)
101-
.value;
98+
_print(Log.printWhite, 'Reading template at: $template...');
99+
final result = await MdTemplateUtility.i.readTemplateFromPathOrUrl(template).value;
102100

103101
if (result.isErr()) {
104102
spinner.stop();
105-
_print(Glog.printRed, ' Failed to read template!');
103+
_print(Log.printRed, ' Failed to read template!');
106104
exit(ExitCodes.FAILURE.code);
107105
}
108106
templateData[template] = result.unwrap();
109107
}
110108

111109
// ---------------------------------------------------------------------------
112110

113-
_print(Glog.printWhite, 'Generating...', spinner);
111+
_print(Log.printWhite, 'Generating...', spinner);
114112
final inputBasename = p.basename(inputPath);
115113
for (final entry in templateData.entries) {
116114
final fileName = p
@@ -132,19 +130,19 @@ Future<void> genIndexes(
132130
),
133131
});
134132

135-
_print(Glog.printWhite, 'Writing output to $fileName...', spinner);
133+
_print(Log.printWhite, 'Writing output to $fileName...', spinner);
136134
try {
137135
await FileSystemUtility.i.writeLocalFile(fileName, data);
138136
} catch (e) {
139-
_print(Glog.printRed, 'Failed to write at: $fileName', spinner);
137+
_print(Log.printRed, 'Failed to write at: $fileName', spinner);
140138
exit(ExitCodes.FAILURE.code);
141139
}
142140
}
143141

144142
// ---------------------------------------------------------------------------
145143

146144
spinner.stop();
147-
_print(Glog.printGreen, 'Done!');
145+
_print(Log.printGreen, 'Done!');
148146
}
149147

150148
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

lib/src/gen_indexes_ts.dart

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Future<void> genIndexesTs(
4646

4747
final help = argResults.flag(DefaultFlags.HELP.name);
4848
if (help) {
49-
_print(Glog.printCyan, parser.getInfo(argParser));
49+
_print(Log.printCyan, parser.getInfo(argParser));
5050
exit(ExitCodes.SUCCESS.code);
5151
}
5252

@@ -59,7 +59,7 @@ Future<void> genIndexesTs(
5959
templates = argResults.multiOption(DefaultMultiOptions.TEMPLATES.name);
6060
} catch (_) {
6161
_print(
62-
Glog.printRed,
62+
Log.printRed,
6363
'Missing required args! Use --help flag for more information.',
6464
);
6565
exit(ExitCodes.FAILURE.code);
@@ -72,7 +72,7 @@ Future<void> genIndexesTs(
7272

7373
// ---------------------------------------------------------------------------
7474

75-
_print(Glog.printWhite, 'Looking for files..');
75+
_print(Log.printWhite, 'Looking for files..');
7676
final filePathStream0 = PathExplorer(inputPath).exploreFiles();
7777
final filePathStream1 = filePathStream0.where((e) {
7878
print(e);
@@ -84,35 +84,33 @@ Future<void> genIndexesTs(
8484
try {
8585
findings = await filePathStream1.toList();
8686
} catch (e) {
87-
_print(Glog.printRed, 'Failed to read file tree!', spinner);
87+
_print(Log.printRed, 'Failed to read file tree!', spinner);
8888
exit(ExitCodes.FAILURE.code);
8989
}
9090
if (findings.isEmpty) {
9191
spinner.stop();
92-
_print(Glog.printYellow, 'No files found in $inputPath!');
92+
_print(Log.printYellow, 'No files found in $inputPath!');
9393
exit(ExitCodes.SUCCESS.code);
9494
}
9595

9696
// ---------------------------------------------------------------------------
9797

9898
final templateData = <String, String>{};
9999
for (final template in templates) {
100-
_print(Glog.printWhite, 'Reading template at: $template...');
101-
final result = await MdTemplateUtility.i
102-
.readTemplateFromPathOrUrl(template)
103-
.value;
100+
_print(Log.printWhite, 'Reading template at: $template...');
101+
final result = await MdTemplateUtility.i.readTemplateFromPathOrUrl(template).value;
104102

105103
if (result.isErr()) {
106104
spinner.stop();
107-
_print(Glog.printRed, ' Failed to read template!');
105+
_print(Log.printRed, ' Failed to read template!');
108106
exit(ExitCodes.FAILURE.code);
109107
}
110108
templateData[template] = result.unwrap();
111109
}
112110

113111
// ---------------------------------------------------------------------------
114112

115-
_print(Glog.printWhite, 'Generating...', spinner);
113+
_print(Log.printWhite, 'Generating...', spinner);
116114

117115
for (final entry in templateData.entries) {
118116
final fileName = p.basename(entry.key).replaceAll('.md', '');
@@ -127,11 +125,11 @@ Future<void> genIndexesTs(
127125
(e) => 'export * from \'./$e\';',
128126
),
129127
});
130-
_print(Glog.printWhite, 'Writing output to $fileName...', spinner);
128+
_print(Log.printWhite, 'Writing output to $fileName...', spinner);
131129
try {
132130
await FileSystemUtility.i.writeLocalFile(fileName, data);
133131
} catch (e) {
134-
_print(Glog.printRed, 'Failed to write at: $fileName', spinner);
132+
_print(Log.printRed, 'Failed to write at: $fileName', spinner);
135133
exit(ExitCodes.FAILURE.code);
136134
}
137135
}
@@ -140,7 +138,7 @@ Future<void> genIndexesTs(
140138

141139
// [STEP 11] Print success!
142140
spinner.stop();
143-
_print(Glog.printGreen, 'Done!');
141+
_print(Log.printGreen, 'Done!');
144142
}
145143

146144
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ environment:
3434
dependencies:
3535
df_config: ^0.7.1
3636
df_gen_core: ^0.6.8
37-
df_log: ^0.3.4
37+
df_log: ^0.3.10
3838
args: ^2.6.0
3939
path: ^1.9.1
4040

@@ -47,7 +47,7 @@ dependencies:
4747
## -----------------------------------------------------------------------------
4848

4949
dev_dependencies:
50-
lints: ^5.0.0
50+
lints: ^6.0.0
5151

5252
## -----------------------------------------------------------------------------
5353

0 commit comments

Comments
 (0)