Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file cli.ml
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273moduleChannel=structtypet=|Stdio|Pipeofstring|SocketofintendmoduleArg=structtypet={mutablepipe:stringoption;mutableport:intoption;mutablestdio:bool;mutablespec:(string*Arg.spec*string)list;mutableclientProcessId:intoption}letportt~name~description=(name,Arg.Int(funp->matcht.portwith|Some_->raise@@Arg.Bad"port is already set once"|None->t.port<-Somep),description);;letcreate()=lett={pipe=None;port=None;stdio=false;spec=[];clientProcessId=None}inletspec=["--pipe",Arg.String(funp->t.pipe<-Somep),"set pipe path";portt~name:"--socket"~description:"set the port";portt~name:"--port"~description:"synonym for --socket";"--stdio",Arg.Unit(fun()->t.stdio<-true),"set stdio";("--node-ipc",Arg.Unit(fun()->raise@@Arg.Bad"node-ipc isn't supported"),"not supported");("--clientProcessId",Arg.Int(funpid->t.clientProcessId<-Somepid),"set the pid of the lsp client")]int.spec<-spec;t;;letspect=t.specletclientProcessIdt=t.clientProcessIdletchannel{pipe;port;stdio;spec=_;clientProcessId=_}:(Channel.t,string)result=matchpipe,port,stdiowith|None,None,_->OkStdio|Somep,None,false->Ok(Pipep)|None,Somes,false->Ok(Sockets)|_,_,_->Error"invalid arguments";;endletargs?channel?clientProcessId()=letargs=matchclientProcessIdwith|None->[]|Somepid->["--clientProcessId";string_of_intpid]inmatch(channel:Channel.toption)with|None->args|SomeStdio->"--stdio"::args|Some(Pipepipe)->"--pipe"::pipe::args|Some(Socketport)->"--socket"::string_of_intport::args;;