(req *ParseCommandLineRequest)
| 562 | } |
| 563 | |
| 564 | func (s *serverImpl) handleParseCommandLine(req *ParseCommandLineRequest) (rsp ParseCommandLineResponse, err error, warns []util.Warning) { |
| 565 | rsp.Env, rsp.Args, err = shells.ParseSimpleCommand(req.CommandLine) |
| 566 | if err != nil { |
| 567 | if errors.Is(err, shells.ErrCommandNotSimple) { |
| 568 | err = nil |
| 569 | } |
| 570 | return |
| 571 | } |
| 572 | |
| 573 | rsp.IsHelpCommand = false |
| 574 | loop: |
| 575 | for _, a := range rsp.Args { |
| 576 | switch a { |
| 577 | case "--help": |
| 578 | rsp.IsHelpCommand = true |
| 579 | break loop |
| 580 | case "--": |
| 581 | break loop |
| 582 | } |
| 583 | } |
| 584 | |
| 585 | var executablePath string |
| 586 | if len(rsp.Args) > 0 { |
| 587 | executablePath, err = datastore.CanonizeExecutablePath( |
| 588 | rsp.Args[0], |
| 589 | req.Dir, |
| 590 | util.GetPathVar(req.Env), |
| 591 | util.GetHomeVar(req.Env), |
| 592 | ) |
| 593 | if err != nil { |
| 594 | return |
| 595 | } |
| 596 | rsp.Args[0] = executablePath |
| 597 | var policy datastore.Policy |
| 598 | policy, err = s.storage.GetCommandPolicy(rsp.Args) |
| 599 | if err != nil { |
| 600 | return |
| 601 | } |
| 602 | if policy != datastore.PolicyUnknown { |
| 603 | rsp.PolicyMode = policy |
| 604 | } else if policy = s.userConfiguration.GetExecutablePolicy(rsp.Args[0]); policy != datastore.PolicyUnknown { |
| 605 | rsp.PolicyMode = policy |
| 606 | } else { |
| 607 | rsp.PolicyMode = datastore.PolicyAsk |
| 608 | } |
| 609 | } |
| 610 | |
| 611 | return |
| 612 | } |
| 613 | |
| 614 | func (s *serverImpl) handleUpdateHelpPageRequest(req *UpdateHelpPageRequest, warner *util.Warner) (rsp UpdateHelpPageResponse, err error) { |
| 615 | cmd := req.Command |
no test coverage detected