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") }