var h=/(?:[a-zA-Z0-9-]+\.)+[a-zA-Z0-9]+/,u=(t,n,o)=>t.startsWith("/")||t.startsWith("~/")||t==="~"?t.replace("~",o):n+(n.endsWith("/")?"":"/")+t,c=async(t,n,o,a)=>{let e=u(t,a,o),{stdout:i}=await n({command:"cat",args:[e]}),r=i.split(`
`).map(s=>s.trim()),p=r.filter(s=>s.toLowerCase().startsWith("include ")).map(s=>s.split(" ")[1]),l=await Promise.all(p.map(s=>c(s,n,o,a)));return[...r,...l.flat()]},m={custom:async(t,n,o)=>{let{stdout:a}=await n({command:"cat",args:[`${o.environmentVariables.HOME}/.ssh/known_hosts`]});return a.split(`
`).map(e=>{let i=h.exec(e);if(i)return String(i)}).filter((e,i,r)=>e&&r.indexOf(e)===i).map(e=>({name:(t[1].endsWith("@")?t[1]:"")+e,description:"SSH host"}))},trigger:"@"},d={custom:async(t,n,o)=>(await c("config",n,o.environmentVariables.HOME,"~/.ssh")).filter(e=>e.trim().toLowerCase().startsWith("host ")&&!e.includes("*")).map(e=>({name:e.split(" ")[1],description:"SSH host",priority:90}))};var g={name:"mosh",description:"",args:{name:"user@hostname",description:"Address of remote machine to log into",generators:[m,d,{template:"history"}]},options:[{name:["--help","-h"],description:"Show help for mosh"},{name:"--client",description:'Mosh client on local machine (default: "mosh-client")'},{name:"--server",description:'Mosh server on remote machine (default: "mosh-server")'},{name:"--predict",description:"Local echo options",requiresEquals:!0,args:{suggestions:[{name:"adaptive",description:"Local echo for slower links [default]"},{name:"always",description:"Use local echo even on fast links"},{name:"never",description:"Never use local echo"},{name:"experimental",description:"Aggressively echo even when incorrect"}]}},{name:"-4",description:"Use IPv4 only"},{name:"-6",description:"Use IPv6 only"},{name:"--family",description:"Network Type",requiresEquals:!0,args:{suggestions:[{name:"inet",description:"Use IPv4 only"},{name:"ine6",description:"Use IPv6 only"},{name:"auto",description:"Autodetect network type for single-family hosts only"},{name:"all",description:"Try all network types"},{name:"prefer-inet4",description:"Use all network types, but try IPv4 first [default]"},{name:"prefer-inet6",description:"Use all network types, but try IPv6 first"}]}},{name:["--port","-p"],description:"Server-side UDP port or range, (No effect on server-side SSH port)"},{name:"--bind-server",description:'{ssh|any|IP}, ask the server to reply from an IP address, (default: "ssh")'},{name:"--ssh",requiresSeparator:!0,args:{name:"command",isCommand:!0},description:'Ssh command to run when setting up session, (example: "ssh -p 2222")'},{name:"--no-ssh-pty",description:"Do not allocate a pseudo tty on ssh connection"},{name:"--no-init",description:"Do not send terminal initialization string"},{name:"--local",description:"Run mosh-server locally without using ssh"},{name:"--experimental-remote-ip",description:"Select the method for discovering the remote IP address to use for mosh",requiresSeparator:!0,args:{name:"method",suggestions:["local","remote","proxy"],default:"proxy"}},{name:"--version",description:"Version and copyright information"}]},v=g;export{v as default};
