Skip to content

Custom exiter #112

@usernametaken

Description

@usernametaken

in cli.go
var exiter = func(code int) {
os.Exit(code)
}

It would be great is this variable is exported so it can be overridden with a custom func

var Exiter = func(code int) {
os.Exit(code)
}

The reason I need this is because I do some initialization (e.g. open DB & log) in my application before I call cli Run
It the cmdline parameters are not complete... help is displayed BUT the After func is not called (so I can't do it there)

I need to to override the exiter to finalize my application (e.g. close the DB connection & log)

The egs are just hypothetical examples but should convey the basic idea

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions