@@ -569,13 +569,10 @@ public ClosestUsageSearch<S> getClosestUsages(Context<S> context) {
569569 var startingNode = root .getChild ((child )-> {
570570 var raw = queue .getOr (0 , null );
571571 if (raw == null ) {
572- System .out .println ("RAW IS NULL" );
573572 return true ;
574573 }
575- System .out .println ("CHILD OF STARTING NODE = " + child .format ());
576574 return child .matchesInput (raw );
577575 });
578- System .out .println ("STARTING NODE = " + (startingNode == null ? "N/A" : startingNode .format ()));
579576
580577 Set <CommandUsage <S >> closestUsages ;
581578
@@ -590,57 +587,16 @@ public ClosestUsageSearch<S> getClosestUsages(Context<S> context) {
590587 return new ClosestUsageSearch <>(closestUsages );
591588 }
592589
593- private @ Nullable ParameterNode <S , ?> getClosestNode (ParameterNode <S , ?> startingNode , Context <S > context ) {
594-
595- ArgumentQueue rawArguments = ArgumentQueue .empty ();
596- rawArguments .addAll (context .arguments ());
597-
598- Queue <ParameterNode <S , ?>> queue = new LinkedList <>();
599- queue .add (startingNode );
600-
601- String inputEntered = null ;
602- while (!queue .isEmpty ()) {
603-
604- ParameterNode <S , ?> currentNode = queue .poll ();
605-
606- if (!rawArguments .isEmpty ()) {
607- inputEntered = rawArguments .poll ();
608- }
609-
610- System .out .println ("CURRENT NODE= " + currentNode .format ());
611- System .out .println ("Raw args is empty: " + rawArguments .isEmpty () );
612- System .out .println ("INPUT ENTERED= " + inputEntered );
613- System .out .println ("CURRENT NODE MATCHES INPUT = " + currentNode .matchesInput (inputEntered ));
614- System .out .println ("IS EXECUTABLE= " + currentNode .isExecutable ());
615-
616- if (rawArguments .isEmpty () && inputEntered != null && currentNode .matchesInput (inputEntered ) && currentNode .isExecutable ()) {
617- System .out .println ("Found matching currentnode=" + currentNode .format ());
618- return currentNode ;
619- }
620-
621- System .out .println ("NOT ACCEPTED AS TERMINAL NODE= " + currentNode .format ());
622-
623- queue .addAll (
624- currentNode .getChildren ()
625- );
626- }
627-
628- return null ;
629- }
630-
631590 private Set <CommandUsage <S >> getClosestUsagesRecursively (
632591 Set <CommandUsage <S >> currentUsages ,
633592 ParameterNode <S , ?> node ,
634593 Context <S > context
635594 ) {
636595 if (node .isExecutable ()) {
637- System .out .println ("EXECUTABLE-NODE= " + node .format ());
638596 var usage = node .getExecutableUsage ();
639597 if (context .imperatConfig ().getPermissionResolver ().hasUsagePermission (context .source (),usage )) {
640598 currentUsages .add (usage );
641599 }
642- }else {
643- System .out .println ("NON-EXECUTABLE-NODE= " + node .format ());
644600 }
645601
646602 if (!node .isLast ()) {
0 commit comments