title: golang cobra subcommands without arguments matching
body: <p>i want to create golang CLI with <a href="https://github.com/spf13/cobra" rel="noreferrer">cobra</a>. For now, it runs well. I have created something like <code>foobar create --username johndoe</code>. But I need subcommands like <code>foobar create user --username johndoe</code>. There is <code>user</code> subcommand. </p>
  
  <p>I have created with arguments matching, </p>
  
  <pre><code>var applicationCmd = &amp;cobra.Command{
     Use:   "application",
     Short: "Create/Read/Update application",
     Long: `You can create any user or partner.`,
     Run: (cmd *cobra.Command, args []string) {
          if len(args) &lt; 1 {
              fmt.Printf("%sPlease choose any object that you want to change e.g (user, partner)%s\n", chalk.Red, chalk.Reset)
          }
          if stringUtil.Contains(args, "user") {
              createUser()
          }
          if stringUtil.Contains(args, "partner") {
              createPartner()
          }
     },
  }
  </code></pre>
  
  <p>but I think there is a better way to do it using cobra rather than using arguments matching like this. Any suggestion?</p>