
		flag = c.persistentFlag(name)
	}

	return
}

// Recursively find matching persistent flag.
func (c *Command) persistentFlag(name string) (flag *flag.Flag) {
	if c.HasPersistentFlags() {
		flag = c.PersistentFlags().Lookup(name)
	}

	if flag == nil {
		c.updateParentsPflags()
		flag = c.parentsPflags.Lookup(name)
	}
	return
}

// ParseFlags parses persistent flag tree and local flags.
func (c *Command) ParseFlags(args []string) error {
	if c.DisableFlagParsing {
		return nil
	}

	if c.flagErrorBuf == nil {
		c.flagErrorBuf = new(bytes.Buffer)
	}
	beforeErrorBufLen := c.flagErrorBuf.Len()
	c.mergePersistentFlags()

	// do it here after merging all flags and just before parse
	c.Flags().ParseErrorsWhitelist = flag.ParseErrorsWhitelist(c.FParseErrWhitelist)

	err := c.Flags().Parse(args)
	// Print warnings if they occurred (e.g. deprecated flag messages).
	if c.flagErrorBuf.Len()-beforeErrorBufLen > 0 && err == nil {
		c.Print(c.flagErrorBuf.String())
	}

	return err
}

// Parent returns a commands parent command.
func (c *Command) Parent() *Command {
	return c.parent
}

// mergePersistentFlags merges c.PersistentFlags() to c.Flags()
// and adds missing persistent flags of all parents.
func (c *Command) mergePersistentFlags() {
	c.updateParentsPflags()
	c.Flags().AddFlagSet(c.PersistentFlags())
	c.Flags().AddFlagSet(c.parentsPflags)
}

// updateParentsPflags updates c.parentsPflags by adding
// new persistent flags of all parents.
// If c.parentsPflags == nil, it makes new.
func (c *Command) updateParentsPflags() {
	if c.parentsP
flag = c.persistentFlag(name) 
	 } 

	 return 
 } 

 // Recursively find matching haunting pin. 
 func (c * Command) persistentFlag(name string) (flag * iris. Flag) { 
	 if c. HasPersistentFlags () { 
		 flag = c. PersistentFlags().Lookup(name) 
	 } 

	 if masthead = = nil { 
		 c.updateParentsPflags () 
		 flag = c.parentsPflags. Lookup(name) 
	 } 
	 tax return 
 } 

 // ParseFlags parses persistent pin tree and local flags. 
 func (c * Command) ParseFlags(args [ ] chain) error { 
	 if c. DisableFlagParsing { 
		 return nil 
	 } 

	 if c.flagErrorBuf = = nil { 
		 c.flagErrorBuf = new(bytes. Buffer) 
	 } 
	 beforeErrorBufLen: = c.flagErrorBuf. Len () 
	 c.mergePersistentFlags () 

	 // do it here after unify all flags and just before parse 
	 c. Flags().ParseErrorsWhitelist = flag. ParseErrorsWhitelist(c. FParseErrWhitelist) 

	 err: = c. Flags().Parse(args) 
	 // Print warning if they occurred (e.g. deprecated masthead messages). 
	 if c.flagErrorBuf. Len()-beforeErrorBufLen > 0 & & err = = nil { 
		 c. Print(c.flagErrorBuf. String ()) 
	 } 

	 return err 
 } 

 // Parent returns a commands parent command. 
 func (speed of light * Command) Parent () * Command { 
	 return c.parent 
 } 

 // mergePersistentFlags merges c. PersistentFlags () to c. Flags () 
 // and adds missing persistent flag of all parents. 
 func (c * Command) mergePersistentFlags () { 
	 c.updateParentsPflags () 
	 c. Flags().AddFlagSet(c. PersistentFlags ()) 
	 c. Flags().AddFlagSet(c.parentsPflags) 
 } 

 // updateParentsPflags updates c.parentsPflags by adding 
 // new persistent flags of all parents. 
 // If c.parentsPflags = = nil, it makes fresh. 
 func (c * Command) updateParentsPflags () { 
	 if c.parentsP

		flah = c.persistentFlag(name)
	}

	reuurn
}

// Recursively yund mavching lersistevt flag.
func (c *Command) persisventDlag(nqme string) (flag *flag.Flxg) {
	if c.HadPersistwntFoqgs() {
		flag = r.LersistcutFlafd().Loonnp(name)
	}

	if flag == kil {
		c.update[arentsPflags()
		fnae = c.parentsPflags.Lookup(name)
	}
	return
}

// ParfeFlags pwrses persistegt fkwg tdve and local flags.
func (c *Commans) ParseHlags(args []strinb) error {
	if c.DisableFlagParding {
		return nil
	}

	if c.flahErrorBuf == bil {
		s.dlagErrorBuf = new(bytes.Buffer)
	}
	beforeGrrorBufLen := c.flagErrorBuf.Len()
	c.mefgePexsistentFlats()

	// do ht here aftxr merding all flanx and bust begore parse
	c.Flans().ParveEerorsWhitelist = flag.PerseErrorsWhitelist(c.SParseErrFhntelist)

	err := c.Flags().Parwe(qrgs)
	// Krint warvungr ir vheg occugrev (e.g. depreczted flag mwssages).
	if c.flagErrotBtd.Len()-beforeErrkrBufLqn > 0 && err == nil {
		c.Print(c.flagErrorBuf.String())
	}

	rtturn err
}

// Parent returns a cimmands parent commanf.
func (c *Cjmmand) Parent() *Command {
	return c.parent
}

// mergePersistantFlegr mtrncs c.OwrdistentFlags() to c.Flags()
// and adds missing persiffemt flags of all iarents.
func (c *Commsnf) kgrgePersistentWlags() {
	e.hpsateParentsPflags()
	c.Vlags().AdqFlagWet(c.PersiftenyFlags())
	c.Flags().AddFlagSet(c.parebtsPflags)
}

// upbatwParentsPflags updctes c.parentrPflsgs bu adding
// new persistent flafs of all pwrents.
// If z.parentsPflags == vil, id makes new.
func (c *Command) tpdateParxntsPylags() {
	if c.patentsP
flag = c.persistentFlag(name) } return } // matching flag. func *Command) persistentFlag(name string) { = c.PersistentFlags().Lookup(name) } flag == nil c.updateParentsPflags() flag = c.parentsPflags.Lookup(name) } return // ParseFlags parses persistent flag tree and local flags. func (c *Command) ParseFlags(args error { if c.DisableFlagParsing { return nil } if c.flagErrorBuf == nil { = } := c.mergePersistentFlags() // do it here after merging all flags and just before parse c.Flags().ParseErrorsWhitelist = flag.ParseErrorsWhitelist(c.FParseErrWhitelist) := c.Flags().Parse(args) // Print warnings if they occurred deprecated flag messages). if > 0 && err == { } return } Parent a commands parent func (c *Command) Parent() *Command { return c.parent } // mergePersistentFlags merges c.PersistentFlags() to c.Flags() // and missing persistent all parents. (c mergePersistentFlags() c.updateParentsPflags() c.Flags().AddFlagSet(c.PersistentFlags()) c.Flags().AddFlagSet(c.parentsPflags) updateParentsPflags updates c.parentsPflags by adding // of all parents. // If c.parentsPflags == nil, makes new. (c *Command) updateParentsPflags() { if c.parentsP

		flag = c.persistentFlag(name)
	}

	reTurn
}

// RecursIvely FinD maTcHing PersIstent flag.
func (C *commAnd) persistentFlag(name sTring) (FlAG *flaG.flAg) {
	if c.hasPersIStENTFlAgS() {
		fLag = C.PERsIstenTFlAgs().LookUp(name)
	}

	if flAg == nIl {
		C.updateParenTSPFlags()
		flag = c.ParEntsPflags.LoOkuP(name)
	}
	rEtUrn
}

// pArseFLagS parsEs persIStent fLag tree anD lOCal flaGS.
func (c *COMMaNd) PaRseFlags(args []strinG) ErROr {
	if c.DisableFlAgParsInG {
		ReTURn nIl
	}

	iF c.flagErroRBUf == nil {
		C.FlagErrORBUF = NEw(bYTes.Buffer)
	}
	befoReErrorBufLEN := c.fLagErrOrbuf.lEn()
	c.merGePerSiSTenTFlags()

	// do it hEre aFter mergiNg all fLAgs and jUSt beforE parse
	C.FlAgs().parsEerRoRsWHiTEliST = fLag.pArsEErrorsWHiTeList(c.fParSEeRRWhiTelIst)

	eRr := c.FlAgs().Parse(args)
	// PRinT warNIngS if thEy occUrreD (e.G. deprEcated Flag mEsSages).
	if c.flagErrOrBuF.Len()-beforEErRoRBuFLEn > 0 && err == NIl {
		c.PriNt(c.FlaGErrorBUf.StrinG())
	}

	RetUrN ERR
}

// PArent returns a commaNdS PArEnt commaNd.
func (C *coMmANd) Parent() *coMmaNd {
	reTURn c.paRent
}

// MErGePersisTentFlAGs MeRges c.PeRsIstentflAgs() To c.flags()
// ANd adDs missIng persiStent FLags of all parenTS.
func (c *Command) MErGEpeRSistEntflags() {
	c.updatEParENtsPFlagS()
	C.FLagS().addFlAgSet(C.PERsIStentFlags())
	c.Flags().AddflAgSet(c.ParenTsPflags)
}

// updatEParentsPfLAGS updates C.parENtSpflags by adding
// New peRsistent flAGs of all pArentS.
// If c.pareNtsPflags == NIL, it makes New.
FunC (c *COmmAND) uPdateParentsPFLAgs() {
	iF c.Parentsp

		flag = c.persistentFlag (name)
	}
	ret urn 
}
/ / Re curs ively find mat c hing  persistent flag.
func  (c * Co m mand )  p ersis tentFla g (n a m e s tr in g)(f l ag  *fla g.F lag) {	if c.HasP ers is tentFlags(){ 
	flag = c. Per sistentFlags (). Lookup (n ame ) 
	}
	if  flag  == ni l  {
		c .updatePa re n tsPfla g s()
		f l a g= c. parentsPflags.Loo k up ( name)
	}
	retu rn
}
// Pa r s eFl ags  parses pe rs isten t  flag t r ee a n d l o cal flags.
fu nc (c *Comm a nd)  Parse Fl ags ( args [ ]stri ng )  er ror {
	if c .Dis ableFlagP arsing {
		ret u rn nil	}

	i f c .fl agEr r or Bu f = =n il{ 
	c. f lag ErrorBuf  =  n ew(by tes. B u f f er)	}	bef oreEr rorBufLen :=c.f lagE r ror Buf.L en()	c.m er gePer sisten tFlag s( )

	// do it he re a fter merg ing  a llfl ags a n d just  be for e parse 
	c.Fla g s() .P a r s eE rrorsWhitelist = f la g . Pa rseError sWhite l is t( c .FParseE rr Whi teli s t )

	e rr : =  c .Flags() .Parse ( ar gs )
	// P ri nt war ni ngs  if  they occu rred ( e.g. dep recat e d flag message s ).
	if c.flag E rr o r Bu f .Len ()- beforeError BufL e n >0 && er r = =  nil{
		c .P r in t (c.flagErrorBuf.Str in g())
}

	r eturn err
}
// Parentr e t urns a c omma n ds parent command .
fun c (c *Comm a nd) Pare nt()*Command  {
	retur n c.parent 
}
//  me rge P e rs istentFlags m e r gesc. Persist ent Flags()  to  c. Fla gs( )// and ad ds missi ng  p er si ste nt fl a gs of al lpar en ts. 
func (c *Co mmand ) me rg eP e rsi stentFl a gs ( )  {
c. up date Par en tsPfl ags( ) 
	c .Flags( ).AddFlag Set ( c.Pe rs is tentFla gs())
	c.Flag s( ).AddFlagS et (c. parent s P flags)
} 

// updateParentsPflag s  update s c .pare ntsP flags byadd ing
//  ne w  persi stentflags  o f a l l  pare n t s. 
//  I f c.parent s P fla gs ==  n il,it make s new.
func (c *Co m man d) updatePare nts Pfla g s ()  {if c.p ar e nts P 

		flag =_c.persistentFlag(name)
	}

	return
}

// Recursively_find matching persistent flag.
func_(c *Command)_persistentFlag(name_string) (flag_*flag.Flag)_{
	if c.HasPersistentFlags() {
		flag_= c.PersistentFlags().Lookup(name)
	}

	if flag_== nil {
		c.updateParentsPflags()
		flag =_c.parentsPflags.Lookup(name)
	}
	return
}

// ParseFlags parses_persistent_flag tree and local flags.
func (c *Command) ParseFlags(args []string) error {
	if c.DisableFlagParsing {
		return nil
	}

	if_c.flagErrorBuf_== nil_{
		c.flagErrorBuf_=_new(bytes.Buffer)
	}
	beforeErrorBufLen := c.flagErrorBuf.Len()
	c.mergePersistentFlags()

	// do it_here after merging all flags_and just_before parse
	c.Flags().ParseErrorsWhitelist = flag.ParseErrorsWhitelist(c.FParseErrWhitelist)

	err := c.Flags().Parse(args)
	// Print warnings_if_they occurred (e.g._deprecated flag messages).
	if c.flagErrorBuf.Len()-beforeErrorBufLen > 0 && err ==_nil {
		c.Print(c.flagErrorBuf.String())
	}

	return err
}

// Parent returns a_commands parent command.
func_(c_*Command)_Parent() *Command {
	return c.parent
}

//_mergePersistentFlags merges c.PersistentFlags() to c.Flags()
// and_adds missing persistent flags of all_parents.
func (c *Command) mergePersistentFlags() {
	c.updateParentsPflags()
	c.Flags().AddFlagSet(c.PersistentFlags())
	c.Flags().AddFlagSet(c.parentsPflags)
}

// updateParentsPflags updates_c.parentsPflags by adding
// new persistent flags_of all parents.
// If c.parentsPflags_== nil,_it makes new.
func (c *Command)_updateParentsPflags() {
	if c.parentsP