@@ -30,7 +30,7 @@ import Unison.Cli.ProjectUtils qualified as ProjectUtils
3030import Unison.Codebase (Codebase )
3131import Unison.Codebase qualified as Codebase
3232import Unison.Codebase.Branch.Merge qualified as Branch
33- import Unison.Codebase.Editor.Input (DeleteOutput (.. ), DeleteTarget (.. ), Input )
33+ import Unison.Codebase.Editor.Input (DeleteOutput (.. ), DeleteTarget (.. ), FindScope ( FindLocalSubnamespace ), Input )
3434import Unison.Codebase.Editor.Input qualified as Input
3535import Unison.Codebase.Editor.Output.PushPull (PushPull (Pull , Push ))
3636import Unison.Codebase.Editor.Output.PushPull qualified as PushPull
@@ -124,7 +124,7 @@ updateBuiltins =
124124 InputPattern
125125 " builtins.update"
126126 []
127- I. Visible
127+ I. Hidden
128128 []
129129 ( " Adds all the builtins that are missing from this namespace, "
130130 <> " and deprecate the ones that don't exist in this version of Unison."
@@ -597,32 +597,55 @@ findAll = find' "find.all" Input.FindLocalAndDeps
597597findGlobal :: InputPattern
598598findGlobal = find' " find.global" Input. FindGlobal
599599
600+ findIn :: InputPattern
601+ findIn =
602+ InputPattern
603+ " find-in"
604+ []
605+ I. Visible
606+ [(" namespace" , Required , namespaceArg)]
607+ findHelp
608+ \ case
609+ p : args -> first P. text do
610+ p <- Path. parsePath p
611+ pure (Input. FindI False (FindLocalSubnamespace p) args)
612+ _ -> Left (I. help updateIn)
613+
614+ findHelp :: P. Pretty CT. ColorText
615+ findHelp =
616+ ( P. wrapColumn2
617+ [ (" `find`" , " lists all definitions in the current namespace." ),
618+ ( " `find foo`" ,
619+ " lists all definitions with a name similar to 'foo' in the current "
620+ <> " namespace (excluding those under 'lib')."
621+ ),
622+ ( " `find foo bar`" ,
623+ " lists all definitions with a name similar to 'foo' or 'bar' in the "
624+ <> " current namespace (excluding those under 'lib')."
625+ ),
626+ (" `find-in namespace`" , " lists all definitions in the specified subnamespace." ),
627+ ( " `find-in namespace foo bar`" ,
628+ " lists all definitions with a name similar to 'foo' or 'bar' in the "
629+ <> " specified subnamespace."
630+ ),
631+ ( " find.all foo" ,
632+ " lists all definitions with a name similar to 'foo' in the current "
633+ <> " namespace (including one level of 'lib')."
634+ ),
635+ ( " find.global foo" ,
636+ " lists all definitions with a name similar to 'foo' in any namespace"
637+ )
638+ ]
639+ )
640+
600641find' :: String -> Input. FindScope -> InputPattern
601642find' cmd fscope =
602643 InputPattern
603644 cmd
604645 []
605646 I. Visible
606647 [(" query" , ZeroPlus , exactDefinitionArg)]
607- ( P. wrapColumn2
608- [ (" `find`" , " lists all definitions in the current namespace." ),
609- ( " `find foo`" ,
610- " lists all definitions with a name similar to 'foo' in the current "
611- <> " namespace (excluding those under 'lib')."
612- ),
613- ( " `find foo bar`" ,
614- " lists all definitions with a name similar to 'foo' or 'bar' in the "
615- <> " current namespace (excluding those under 'lib')."
616- ),
617- ( " find.all foo" ,
618- " lists all definitions with a name similar to 'foo' in the current "
619- <> " namespace (including one level of 'lib')."
620- ),
621- ( " find.global foo" ,
622- " lists all definitions with a name similar to 'foo' in any namespace"
623- )
624- ]
625- )
648+ findHelp
626649 (pure . Input. FindI False fscope)
627650
628651findShallow :: InputPattern
@@ -968,11 +991,11 @@ aliasMany =
968991up :: InputPattern
969992up =
970993 InputPattern
971- " up"
994+ " deprecated. up"
972995 []
973996 I. Visible
974997 []
975- (P. wrapColumn2 [(makeExample up [] , " move current path up one level" )])
998+ (P. wrapColumn2 [(makeExample up [] , " move current path up one level (deprecated) " )])
976999 ( \ case
9771000 [] -> Right Input. UpI
9781001 _ -> Left (I. help up)
@@ -981,12 +1004,12 @@ up =
9811004cd :: InputPattern
9821005cd =
9831006 InputPattern
984- " namespace "
985- [" cd " , " j " ]
1007+ " deprecated.cd "
1008+ [" deprecated.namespace " ]
9861009 I. Visible
9871010 [(" namespace" , Required , namespaceArg)]
9881011 ( P. lines
989- [ " Moves your perspective to a different namespace." ,
1012+ [ " Moves your perspective to a different namespace. Deprecated for now because too many important things depend on your perspective selection. " ,
9901013 " " ,
9911014 P. wrapColumn2
9921015 [ ( makeExample cd [" foo.bar" ],
@@ -1020,7 +1043,7 @@ back =
10201043 []
10211044 ( P. wrapColumn2
10221045 [ ( makeExample back [] ,
1023- " undoes the last" <> makeExample' cd <> " command."
1046+ " undoes the last" <> makeExample' projectSwitch <> " or " <> makeExample' cd <> " command."
10241047 )
10251048 ]
10261049 )
@@ -1231,17 +1254,20 @@ reset =
12311254resetRoot :: InputPattern
12321255resetRoot =
12331256 InputPattern
1234- " reset-root"
1257+ " deprecated. reset-root"
12351258 []
12361259 I. Visible
12371260 [(" namespace or hash to reset to" , Required , namespaceArg)]
1238- ( P. wrapColumn2
1239- [ ( makeExample resetRoot [" .foo" ],
1240- " Reset the root namespace (along with its history) to that of the `.foo` namespace."
1241- ),
1242- ( makeExample resetRoot [" #9dndk3kbsk13nbpeu" ],
1243- " Reset the root namespace (along with its history) to that of the namespace with hash `#9dndk3kbsk13nbpeu`."
1244- )
1261+ ( P. lines
1262+ [ " Deprecated because it's not compatible with the introduction of projects." ,
1263+ P. wrapColumn2
1264+ [ ( makeExample resetRoot [" .foo" ],
1265+ " Reset the root namespace (along with its history) to that of the `.foo` namespace. Deprecated"
1266+ ),
1267+ ( makeExample resetRoot [" #9dndk3kbsk13nbpeu" ],
1268+ " Reset the root namespace (along with its history) to that of the namespace with hash `#9dndk3kbsk13nbpeu`."
1269+ )
1270+ ]
12451271 ]
12461272 )
12471273 \ case
@@ -2982,6 +3008,7 @@ validInputs =
29823008 editNamespace,
29833009 execute,
29843010 find,
3011+ findIn,
29853012 findAll,
29863013 findGlobal,
29873014 findPatch,
0 commit comments