code: func (c *FlattenSpec) Execute(args []string) error {
  	if len(args) != 1 {
  		return errors.New("The flatten command requires the single swagger document url to be specified")
  	}
  
  	swaggerDoc := args[0]
  	specDoc, err := loads.Spec(swaggerDoc)
  	if err != nil {
  		return err
  	}
  
  	flattenOpts := c.FlattenCmdOptions.SetFlattenOptions(&analysis.FlattenOpts{
  		// defaults
  		Minimal:      true,
  		Verbose:      true,
  		Expand:       false,
  		RemoveUnused: false,
  	})
  	flattenOpts.BasePath = specDoc.SpecFilePath()
  	flattenOpts.Spec = analysis.New(specDoc.Spec())
  	if err := analysis.Flatten(*flattenOpts); err != nil {
  		return err
  	}
  
  	return writeToFile(specDoc.Spec(), !c.Compact, c.Format, string(c.Output))
  }
docs: // Execute flattens the spec