From aa2f817b3bee93f09327478e9a9f7dcb2c507168 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Wed, 6 Dec 2023 10:29:01 +0100 Subject: [PATCH] fish_indent: readd missing return on -h/-v --- fish-rust/src/fish_indent.rs | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) mode change 100644 => 100755 fish-rust/src/fish_indent.rs diff --git a/fish-rust/src/fish_indent.rs b/fish-rust/src/fish_indent.rs old mode 100644 new mode 100755 index 70d8ef2f6..664a8cade --- a/fish-rust/src/fish_indent.rs +++ b/fish-rust/src/fish_indent.rs @@ -10,7 +10,7 @@ use crate::ast::{ self, Ast, Category, Leaf, List, Node, NodeVisitor, SourceRangeList, Traversal, Type, }; -use crate::builtins::shared::STATUS_CMD_ERROR; +use crate::builtins::shared::{STATUS_CMD_ERROR, STATUS_CMD_OK}; use crate::common::{ str2wcstring, unescape_string, wcs2string, wcs2zstring, UnescapeFlags, UnescapeStringStyle, PROGRAM_NAME, @@ -787,15 +787,21 @@ enum OutputType { while let Some(c) = w.wgetopt_long() { match c { 'P' => DUMP_PARSE_TREE.store(true), - 'h' => print_help("fish_indent"), - 'v' => printf!( - "%s", - wgettext_fmt!( - "%s, version %s\n", - PROGRAM_NAME.get().unwrap(), - crate::BUILD_VERSION - ) - ), + 'h' => { + print_help("fish_indent"); + return STATUS_CMD_OK.unwrap(); + } + 'v' => { + printf!( + "%s", + wgettext_fmt!( + "%s, version %s\n", + PROGRAM_NAME.get().unwrap(), + crate::BUILD_VERSION + ) + ); + return STATUS_CMD_OK.unwrap(); + } 'w' => output_type = OutputType::File, 'i' => do_indent = false, '\x01' => output_type = OutputType::Html,