mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
internal/command: demote modulePath() export (#617)
Signed-off-by: Lars Lehtonen <lars.lehtonen@gmail.com>
This commit is contained in:
parent
92abeb27eb
commit
6cd1c00e1d
@ -43,7 +43,7 @@ func (m *Meta) completePredictWorkspaceName() complete.Predictor {
|
||||
// directory, since we don't have enough context to know where to
|
||||
// find any config path argument, and it might be _after_ the argument
|
||||
// we're trying to complete here anyway.
|
||||
configPath, err := ModulePath(nil)
|
||||
configPath, err := modulePath(nil)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ is configured to use a non-local backend. This backend doesn't support this
|
||||
operation.
|
||||
`
|
||||
|
||||
// ModulePath returns the path to the root module and validates CLI arguments.
|
||||
// modulePath returns the path to the root module and validates CLI arguments.
|
||||
//
|
||||
// This centralizes the logic for any commands that previously accepted
|
||||
// a module path via CLI arguments. This will error if any extraneous arguments
|
||||
@ -58,7 +58,7 @@ operation.
|
||||
//
|
||||
// If your command accepts more than one arg, then change the slice bounds
|
||||
// to pass validation.
|
||||
func ModulePath(args []string) (string, error) {
|
||||
func modulePath(args []string) (string, error) {
|
||||
// TODO: test
|
||||
|
||||
if len(args) > 0 {
|
||||
|
@ -35,7 +35,7 @@ func (c *ConsoleCommand) Run(args []string) int {
|
||||
return 1
|
||||
}
|
||||
|
||||
configPath, err := ModulePath(cmdFlags.Args())
|
||||
configPath, err := modulePath(cmdFlags.Args())
|
||||
if err != nil {
|
||||
c.Ui.Error(err.Error())
|
||||
return 1
|
||||
|
@ -35,7 +35,7 @@ func (c *GetCommand) Run(args []string) int {
|
||||
ctx, done := c.InterruptibleContext(c.CommandContext())
|
||||
defer done()
|
||||
|
||||
path, err := ModulePath(cmdFlags.Args())
|
||||
path, err := modulePath(cmdFlags.Args())
|
||||
if err != nil {
|
||||
c.Ui.Error(err.Error())
|
||||
return 1
|
||||
|
@ -42,7 +42,7 @@ func (c *GraphCommand) Run(args []string) int {
|
||||
return 1
|
||||
}
|
||||
|
||||
configPath, err := ModulePath(cmdFlags.Args())
|
||||
configPath, err := modulePath(cmdFlags.Args())
|
||||
if err != nil {
|
||||
c.Ui.Error(err.Error())
|
||||
return 1
|
||||
|
@ -100,7 +100,7 @@ func (c *InitCommand) Run(args []string) int {
|
||||
|
||||
// Validate the arg count and get the working directory
|
||||
args = cmdFlags.Args()
|
||||
path, err := ModulePath(args)
|
||||
path, err := modulePath(args)
|
||||
if err != nil {
|
||||
c.Ui.Error(err.Error())
|
||||
return 1
|
||||
|
@ -41,7 +41,7 @@ func (c *ProvidersCommand) Run(args []string) int {
|
||||
return 1
|
||||
}
|
||||
|
||||
configPath, err := ModulePath(cmdFlags.Args())
|
||||
configPath, err := modulePath(cmdFlags.Args())
|
||||
if err != nil {
|
||||
c.Ui.Error(err.Error())
|
||||
return 1
|
||||
|
@ -44,7 +44,7 @@ func (c *UnlockCommand) Run(args []string) int {
|
||||
|
||||
// assume everything is initialized. The user can manually init if this is
|
||||
// required.
|
||||
configPath, err := ModulePath(args)
|
||||
configPath, err := modulePath(args)
|
||||
if err != nil {
|
||||
c.Ui.Error(err.Error())
|
||||
return 1
|
||||
|
@ -46,7 +46,7 @@ func (c *WorkspaceDeleteCommand) Run(args []string) int {
|
||||
return cli.RunResultHelp
|
||||
}
|
||||
|
||||
configPath, err := ModulePath(args[1:])
|
||||
configPath, err := modulePath(args[1:])
|
||||
if err != nil {
|
||||
c.Ui.Error(err.Error())
|
||||
return 1
|
||||
|
@ -30,7 +30,7 @@ func (c *WorkspaceListCommand) Run(args []string) int {
|
||||
}
|
||||
|
||||
args = cmdFlags.Args()
|
||||
configPath, err := ModulePath(args)
|
||||
configPath, err := modulePath(args)
|
||||
if err != nil {
|
||||
c.Ui.Error(err.Error())
|
||||
return 1
|
||||
|
@ -61,7 +61,7 @@ func (c *WorkspaceNewCommand) Run(args []string) int {
|
||||
return 1
|
||||
}
|
||||
|
||||
configPath, err := ModulePath(args[1:])
|
||||
configPath, err := modulePath(args[1:])
|
||||
if err != nil {
|
||||
c.Ui.Error(err.Error())
|
||||
return 1
|
||||
|
@ -37,7 +37,7 @@ func (c *WorkspaceSelectCommand) Run(args []string) int {
|
||||
return cli.RunResultHelp
|
||||
}
|
||||
|
||||
configPath, err := ModulePath(args[1:])
|
||||
configPath, err := modulePath(args[1:])
|
||||
if err != nil {
|
||||
c.Ui.Error(err.Error())
|
||||
return 1
|
||||
|
Loading…
Reference in New Issue
Block a user