• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

UiPath / uipathcli / 6442892572

07 Oct 2023 06:45PM UTC coverage: 67.119% (-23.3%) from 90.418%
6442892572

push

github

thschmitt
Upgrade to golang 1.21, update dependencies to latest versions

- Upgrade to golang 1.21
- Update all dependencies to latest versions

3068 of 4571 relevant lines covered (67.12%)

362.28 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

86.96
/commandline/cli.go
1
// Package commandline is responsible for creating, parsing and validating
2
// command line arguments.
3
package commandline
4

5
import (
6
        "fmt"
7
        "io"
8

9
        "github.com/UiPath/uipathcli/config"
10
        "github.com/UiPath/uipathcli/executor"
11
        "github.com/UiPath/uipathcli/utils"
12
        "github.com/urfave/cli/v2"
13
)
14

15
// Cli is a wrapper for building the CLI commands.
16
type Cli struct {
17
        stdIn              io.Reader
18
        stdOut             io.Writer
19
        stdErr             io.Writer
20
        coloredOutput      bool
21
        definitionProvider DefinitionProvider
22
        configProvider     config.ConfigProvider
23
        executor           executor.Executor
24
        pluginExecutor     executor.Executor
25
}
26

27
func (c Cli) run(args []string, input utils.Stream) error {
39✔
28
        err := c.configProvider.Load()
39✔
29
        if err != nil {
39✔
30
                return err
×
31
        }
×
32

33
        CommandBuilder := CommandBuilder{
39✔
34
                Input:              input,
39✔
35
                StdIn:              c.stdIn,
39✔
36
                StdOut:             c.stdOut,
39✔
37
                StdErr:             c.stdErr,
39✔
38
                ConfigProvider:     c.configProvider,
39✔
39
                Executor:           c.executor,
39✔
40
                PluginExecutor:     c.pluginExecutor,
39✔
41
                DefinitionProvider: c.definitionProvider,
39✔
42
        }
39✔
43
        flags := CommandBuilder.CreateDefaultFlags(false)
39✔
44
        commands, err := CommandBuilder.Create(args)
39✔
45
        if err != nil {
39✔
46
                return err
×
47
        }
×
48

49
        app := &cli.App{
39✔
50
                Name:                      "uipath",
39✔
51
                Usage:                     "Command-Line Interface for UiPath Services",
39✔
52
                UsageText:                 "uipath <service> <operation> --parameter",
39✔
53
                Version:                   "1.0",
39✔
54
                Flags:                     flags,
39✔
55
                Commands:                  commands,
39✔
56
                Writer:                    c.stdOut,
39✔
57
                ErrWriter:                 c.stdErr,
39✔
58
                HideVersion:               true,
39✔
59
                HideHelpCommand:           true,
39✔
60
                DisableSliceFlagSeparator: true,
39✔
61
        }
39✔
62
        return app.Run(args)
39✔
63
}
64

65
const colorRed = "\033[31m"
66
const colorReset = "\033[0m"
67

68
func (c Cli) Run(args []string, input utils.Stream) error {
39✔
69
        err := c.run(args, input)
39✔
70
        if err != nil {
61✔
71
                message := err.Error()
22✔
72
                if c.coloredOutput {
22✔
73
                        message = colorRed + err.Error() + colorReset
×
74
                }
×
75
                fmt.Fprintln(c.stdErr, message)
22✔
76
        }
77
        return err
39✔
78
}
79

80
func NewCli(
81
        stdIn io.Reader,
82
        stdOut io.Writer,
83
        stdErr io.Writer,
84
        colors bool,
85
        definitionProvider DefinitionProvider,
86
        configProvider config.ConfigProvider,
87
        executor executor.Executor,
88
        pluginExecutor executor.Executor,
89
) *Cli {
39✔
90
        return &Cli{stdIn, stdOut, stdErr, colors, definitionProvider, configProvider, executor, pluginExecutor}
39✔
91
}
39✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc