Uses actual cli arg to add feed

This commit is contained in:
Dennis Schoepf 2024-09-03 19:51:03 +02:00
parent 55e9424d7a
commit 7d349999bf

View file

@ -17,20 +17,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package cmd package cmd
import ( import (
"fmt" feed "freed/internal"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
type Feed struct {
ID int
URL string
}
// addCmd represents the add command // addCmd represents the add command
var addCmd = &cobra.Command{ var addCmd = &cobra.Command{
Use: "add", Use: "add",
Args: cobra.MinimumNArgs(1), Args: cobra.ExactArgs(1),
Short: "Adds a new feed to the application.", Short: "Adds a new feed to the application.",
Long: `Validates and stores a feed in the application's database. Depending on the feed type, articles, videos, or updates are fetched right away. Long: `Validates and stores a feed in the application's database. Depending on the feed type, articles, videos, or updates are fetched right away.
@ -38,7 +33,7 @@ Supported types currently are:
- RSS - RSS
- Youtube Channel links`, - Youtube Channel links`,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
fmt.Println("Not implemented. Feed will be added here") feed.Add(args[0])
}, },
} }