Skip to content

Custom magic command options seems to be empty in F# #959

@PawelStadnicki

Description

@PawelStadnicki

I have my own magic command created like this:

let command = new Command("#!mymagiccommand")
command.AddOption(new Option<string>("--load"))
command.AddOption(new Option<string>("--name"))
//this is not necessary, just to ensure typing
let d = System.Func<string, string, KernelInvocationContext, Task>(commandHandler)
command.Handler <-CommandHandler.Create(d)

Options seems to be registered correctly:
#!mymagicommand -h :

  #!mymagiccommand [options]

Options:
  --load <load>
  --name <name>    
  -?, -h, --help       Show help and usage information

However inside the command handler the option parameters seems to be empty

let commandHandler (load:string) (name:string) (context:KernelInvocationContext): Task = 
        context.Display (sprintf "load param is %s" load) |> ignore
        context.Display (sprintf $"name param is {name}") |> ignore

as

#!mymagiccommand --load loader --name name
or
#!mymagiccommand --load "loader" --name "name"
results with

load param is
name param is

Any clues ? Do I use it wrongly somehow or F# is not well supported in this case?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions