File tree Expand file tree Collapse file tree 1 file changed +37
-1
lines changed
Expand file tree Collapse file tree 1 file changed +37
-1
lines changed Original file line number Diff line number Diff line change 1- ./to_md.sh ./packages/document document.md --include dart yaml sh --exclude ' *.g.dart' ' *.freezed.dart' ' app.*.dart' ' *.form.dart' ' *.mocks.dart'
1+ #! /bin/bash
2+
3+ # Check if package name parameter was provided
4+ if [ -z " $1 " ]; then
5+ echo " Error: Package name is required as first parameter"
6+ echo " Usage: $0 PACKAGE_NAME [OUTPUT_FILE] [OPTIONS]"
7+ exit 1
8+ fi
9+
10+ # Verify the package directory exists
11+ PACKAGE_DIR=" ./packages/$1 "
12+ if [ ! -d " $PACKAGE_DIR " ]; then
13+ echo " Error: Package directory '$PACKAGE_DIR ' does not exist"
14+ exit 2
15+ fi
16+
17+ # Set default output file if not provided
18+ OUTPUT_FILE=" $2 "
19+ if [ -z " $OUTPUT_FILE " ]; then
20+ OUTPUT_FILE=" $1 .md"
21+ # Shift arguments to adjust for optional parameter
22+ shift 1
23+ else
24+ # Shift arguments twice to maintain correct positioning for remaining args
25+ shift 2
26+ fi
27+
28+ # Execute to_md.sh command with all arguments
29+ ./to_md.sh " $PACKAGE_DIR " " $OUTPUT_FILE " --include dart yaml sh --exclude ' *.g.dart' ' *.freezed.dart' ' app.*.dart' ' *.form.dart' ' *.mocks.dart' " $@ "
30+
31+ # Check the execution status
32+ if [ $? -eq 0 ]; then
33+ echo " Successfully processed $PACKAGE_DIR to $OUTPUT_FILE "
34+ else
35+ echo " Error occurred while processing $PACKAGE_DIR "
36+ exit 4
37+ fi
You can’t perform that action at this time.
0 commit comments