Skip to content

Commit

Permalink
🧹 Make path an arg, not a flag for the FS conn. (#4108)
Browse files Browse the repository at this point in the history
Signed-off-by: Preslav <preslav@mondoo.com>
  • Loading branch information
preslavgerchev authored May 27, 2024
1 parent a49f250 commit be98dcb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 3 additions & 2 deletions providers/os/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,16 +249,17 @@ var Config = plugin.Provider{
{
Name: "filesystem",
Aliases: []string{"fs"},
Use: "filesystem [flags]",
Use: "filesystem PATH [flags]",
Short: "a mounted file system target",
MinArgs: 0,
MaxArgs: 0,
MaxArgs: 1,
Flags: []plugin.Flag{
{
Long: "path",
Type: plugin.FlagType_String,
Default: "",
Desc: "Path to a local file or directory for the connection to use.",
Option: plugin.FlagOption_Deprecated,
},
},
},
Expand Down
5 changes: 5 additions & 0 deletions providers/os/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ func (s *Service) ParseCLI(req *plugin.ParseCLIReq) (*plugin.ParseCLIRes, error)
}
case "filesystem", "fs":
conf.Type = shared.Type_FileSystem.String()
if len(req.Args) > 0 {
conf.Path = req.Args[0]
} else {
log.Warn().Msg("no path provided as an arg, looking for --path flag")
}
}

user := ""
Expand Down

0 comments on commit be98dcb

Please sign in to comment.