feat: support merging multiple subscriptions
This commit is contained in:
@ -16,6 +16,7 @@ func newSubscriptionCmd() *cobra.Command {
|
||||
newSubscriptionSetURLCmd(),
|
||||
newSubscriptionGetURLCmd(),
|
||||
newSubscriptionActivateCmd(),
|
||||
newSubscriptionDeactivateCmd(),
|
||||
newSubscriptionListCmd(),
|
||||
newSubscriptionStorageCmd(),
|
||||
)
|
||||
@ -126,7 +127,7 @@ func newSubscriptionGetURLCmd() *cobra.Command {
|
||||
func newSubscriptionActivateCmd() *cobra.Command {
|
||||
return &cobra.Command{
|
||||
Use: "activate <name>",
|
||||
Short: "Activate a subscription",
|
||||
Short: "Activate a subscription (additive — other active subscriptions stay active)",
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
m, err := newManagers("", "", "")
|
||||
@ -142,6 +143,25 @@ func newSubscriptionActivateCmd() *cobra.Command {
|
||||
}
|
||||
}
|
||||
|
||||
func newSubscriptionDeactivateCmd() *cobra.Command {
|
||||
return &cobra.Command{
|
||||
Use: "deactivate <name>",
|
||||
Short: "Deactivate a subscription",
|
||||
Args: cobra.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
m, err := newManagers("", "", "")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
m.Subscription.DeactivateSubscription(args[0])
|
||||
if m.CoreConfig.Apply() {
|
||||
m.Core.ReloadService("mihomo")
|
||||
}
|
||||
return nil
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func newSubscriptionListCmd() *cobra.Command {
|
||||
return &cobra.Command{
|
||||
Use: "list",
|
||||
|
||||
Reference in New Issue
Block a user