feat: better convert usage

This commit is contained in:
2026-02-05 22:28:53 -05:00
parent 53042ea26d
commit b47a3a3acb
3 changed files with 15 additions and 9 deletions

View File

@@ -25,11 +25,14 @@ func LambdaConvert() *cobra.Command {
var inputReprFlag, outputReprFlag string
cmd := &cobra.Command{
Use: "convert <input> <output>",
Use: "convert <input-file> <output-file>",
Short: "Convert between lambda calculus representations",
Args: cobra.ExactArgs(2),
SilenceUsage: true,
RunE: func(_ *cobra.Command, args []string) error {
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) != 2 {
return cmd.Help()
}
var err error
inputPath, outputPath := args[0], args[1]
@@ -71,7 +74,7 @@ func LambdaConvert() *cobra.Command {
// Marshal output.
output, err := r.Marshal(result)
if err != nil {
return fmt.Errorf("marshaling output: %w", err)
return fmt.Errorf("unmarshaling output: %w", err)
}
// Write output file.