mirror of
https://github.com/kjanat/articulate-parser.git
synced 2026-01-16 07:42:09 +01:00
refactor: Standardize method names and introduce context propagation
Removes the `Get` prefix from exporter methods (e.g., GetSupportedFormat -> SupportedFormat) to better align with Go conventions for simple accessors. Introduces `context.Context` propagation through the application, starting from `ProcessCourseFromURI` down to the HTTP request in the parser. This makes network operations cancellable and allows for setting deadlines, improving application robustness. Additionally, optimizes the HTML cleaner by pre-compiling regular expressions for a minor performance gain.
This commit is contained in:
4
main.go
4
main.go
@ -40,13 +40,13 @@ func run(args []string) int {
|
||||
|
||||
// Check for help flag
|
||||
if len(args) > 1 && (args[1] == "--help" || args[1] == "-h" || args[1] == "help") {
|
||||
printUsage(args[0], app.GetSupportedFormats())
|
||||
printUsage(args[0], app.SupportedFormats())
|
||||
return 0
|
||||
}
|
||||
|
||||
// Check for required command-line arguments
|
||||
if len(args) < 4 {
|
||||
printUsage(args[0], app.GetSupportedFormats())
|
||||
printUsage(args[0], app.SupportedFormats())
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user