Skip to content

Readme.md missing a VB.NET example #333

@jochenwezel

Description

@jochenwezel

you might want to provide a VB.NET sample at readme.md or other appropriate documentation

Option Explicit On
Option Strict On

Imports CommandLine

Module MainApp

    Sub Main(args As String())
        Dim result As CommandLine.ParserResult(Of Options)
        result = CommandLine.Parser.Default.ParseArguments(Of Options)(args)
        Dim exitCode As Integer = result.MapResult(AddressOf Start, AddressOf ParserErrors)
        System.Environment.Exit(exitCode)
    End Sub

    Private Function Start(options As Options) As Integer
        Try
            'Do some stuff here...
            Return Nothing '-> exit code = 0
        Catch ex As Exception
            Return 2
        End Try
    End Function

    Private Function ParserErrors(errors As IEnumerable(Of [Error])) As Integer
        Console.WriteLine("Please resolve errors above, first")
        Return 1
    End Function

End Module

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