@@ -734,13 +734,13 @@ func (snc *Agent) logPanicRecover() {
734734
735735// RunCheck calls check by name and returns the check result.
736736func (snc * Agent ) RunCheck (name string , args []string ) * CheckResult {
737- return snc .RunCheckWithContext (context .TODO (), name , args , 0 , nil )
737+ return snc .RunCheckWithContext (context .TODO (), name , args , 0 , nil , false )
738738}
739739
740740// RunCheckWithContext calls check by name and returns the check result.
741741// secCon configuration section will be used to check for nasty characters and allowed arguments.
742- func (snc * Agent ) RunCheckWithContext (ctx context.Context , name string , args []string , timeoutOverride float64 , transportConf * ConfigSection ) * CheckResult {
743- res , chk := snc .runCheck (ctx , name , args , timeoutOverride , transportConf , false )
742+ func (snc * Agent ) RunCheckWithContext (ctx context.Context , name string , args []string , timeoutOverride float64 , transportConf * ConfigSection , skipAlias bool ) * CheckResult {
743+ res , chk := snc .runCheck (ctx , name , args , timeoutOverride , transportConf , false , skipAlias )
744744 if res .Raw == nil || res .Raw .showHelp == 0 {
745745 if chk != nil {
746746 res .Finalize (chk .timezone )
@@ -752,13 +752,13 @@ func (snc *Agent) RunCheckWithContext(ctx context.Context, name string, args []s
752752 return res
753753}
754754
755- func (snc * Agent ) runCheck (ctx context.Context , name string , args []string , timeoutOverride float64 , transportConf * ConfigSection , skipAllowedCheck bool ) (* CheckResult , * CheckData ) {
755+ func (snc * Agent ) runCheck (ctx context.Context , name string , args []string , timeoutOverride float64 , transportConf * ConfigSection , skipAllowedCheck , skipAlias bool ) (* CheckResult , * CheckData ) {
756756 log .Tracef ("command: %s" , name )
757757 log .Tracef ("args: %#v" , args )
758758 if deadline , ok := ctx .Deadline (); ok {
759759 log .Tracef ("ctx deadline: %s" , time .Until (deadline ).String ())
760760 }
761- check , ok := snc .getCheck (name )
761+ check , ok := snc .getCheck (name , skipAlias )
762762 if ! ok {
763763 return & CheckResult {
764764 State : CheckExitUnknown ,
@@ -857,6 +857,12 @@ func (snc *Agent) runHelp(ctx context.Context, chk *CheckData, handler CheckHand
857857 switch builtin := handler .(type ) {
858858 case * CheckBuiltin :
859859 help = builtin .Help (ctx , snc , chk , chk .showHelp )
860+ case * CheckAlias :
861+ alias , ok := snc .getCheck (builtin .command , true )
862+ if ok {
863+ realChk := alias .Handler ().Build ()
864+ help = realChk .Help (chk .showHelp )
865+ }
860866 default :
861867 help = chk .Help (chk .showHelp )
862868 }
@@ -868,10 +874,12 @@ func (snc *Agent) runHelp(ctx context.Context, chk *CheckData, handler CheckHand
868874 }
869875}
870876
871- func (snc * Agent ) getCheck (name string ) (_ * CheckEntry , ok bool ) {
877+ func (snc * Agent ) getCheck (name string , skipAlias bool ) (_ * CheckEntry , ok bool ) {
872878 if snc .runSet != nil {
873- if chk , ok := snc .runSet .cmdAliases [name ]; ok {
874- return & chk , ok
879+ if ! skipAlias {
880+ if chk , ok := snc .runSet .cmdAliases [name ]; ok {
881+ return & chk , ok
882+ }
875883 }
876884 if chk , ok := snc .runSet .cmdWraps [name ]; ok {
877885 return & chk , ok
0 commit comments