about summary refs log tree commit diff
path: root/pkgs/profpatsch/dhallsh
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2019-09-09 01:54:51 +0200
committerProfpatsch <mail@profpatsch.de>2020-02-24 00:57:55 +0100
commit2ace5fa1648b530f5cf0b19ad32c9a4fe44334fc (patch)
treeb10cae6e9650319110ba8569a09ac43994418c2e /pkgs/profpatsch/dhallsh
parent4518fe3ce66364a0dc86d989ab749bce6aa876c0 (diff)
`abc foo --bar` can be completed
Diffstat (limited to 'pkgs/profpatsch/dhallsh')
-rw-r--r--pkgs/profpatsch/dhallsh/main.dhall25
1 files changed, 23 insertions, 2 deletions
diff --git a/pkgs/profpatsch/dhallsh/main.dhall b/pkgs/profpatsch/dhallsh/main.dhall
index 36be6142..86300b79 100644
--- a/pkgs/profpatsch/dhallsh/main.dhall
+++ b/pkgs/profpatsch/dhallsh/main.dhall
@@ -125,7 +125,7 @@ in  let fishSeenSubcommandFn = "__fish_seen_subcommand_from"
 
 	let fishUseSubcommandFn = "__fish_use_subcommand"
 
-	let foo
+	let fooSubcommand
 		: Command Argument
 		= completeToCommand
 		  (   complete { cmd = "abc", description = "this is foo option" }
@@ -136,5 +136,26 @@ in  let fishSeenSubcommandFn = "__fish_seen_subcommand_from"
 			  }
 		  )
 
-	in    [ argCommandToList foo, [ "complete", "--do-complete=abc " ] ]
+	let fooSubcommandBarOption
+		: Command Argument
+		= completeToCommand
+		  (   complete { cmd = "abc", description = "will bar the baz" }
+			⫽ { condition =
+				  Some
+				  { cmd =
+					  fishSeenSubcommandFn
+				  , args =
+					  [ Argument.Plain "foo" ]
+				  }
+			  , long-option =
+				  Some "bar"
+			  , short-option =
+				  Some "b"
+			  }
+		  )
+
+	in    [ argCommandToList fooSubcommand
+		  , argCommandToList fooSubcommandBarOption
+		  , [ "complete", "--do-complete=abc foo -" ]
+		  ]
 		: List (List Text)