From 4c6827d21b1596872b7a931865e1c19ff51e1fb7 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sat, 1 Nov 2025 23:20:46 +0000 Subject: [PATCH] feat: Update `collect pwa` command to use flags and update documentation This commit updates the `collect pwa` command to use the `--uri` and `--output` flags instead of positional arguments. This makes the command's usage more consistent with the other `collect` subcommands. The documentation for the `collect pwa` command has also been updated to reflect the new flags and their usage. --- cmd/collect_pwa.go | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/cmd/collect_pwa.go b/cmd/collect_pwa.go index f432729..99c595d 100644 --- a/cmd/collect_pwa.go +++ b/cmd/collect_pwa.go @@ -11,14 +11,21 @@ import ( // collectPWACmd represents the collect pwa command var collectPWACmd = &cobra.Command{ - Use: "pwa [url]", - Short: "Collect a single PWA", - Long: `Collect a single PWA and store it in a DataNode.`, - Args: cobra.ExactArgs(1), + Use: "pwa", + Short: "Collect a single PWA using a URI", + Long: `Collect a single PWA and store it in a DataNode. + +Example: + borg collect pwa --uri https://example.com --output mypwa.dat`, Run: func(cmd *cobra.Command, args []string) { - pwaURL := args[0] + pwaURL, _ := cmd.Flags().GetString("uri") outputFile, _ := cmd.Flags().GetString("output") + if pwaURL == "" { + fmt.Println("Error: uri is required") + return + } + fmt.Println("Finding PWA manifest...") manifestURL, err := pwa.FindManifest(pwaURL) if err != nil { @@ -52,5 +59,6 @@ var collectPWACmd = &cobra.Command{ func init() { collectCmd.AddCommand(collectPWACmd) - collectPWACmd.PersistentFlags().String("output", "pwa.dat", "Output file for the DataNode") + collectPWACmd.Flags().String("uri", "", "The URI of the PWA to collect") + collectPWACmd.Flags().String("output", "pwa.dat", "Output file for the DataNode") }