gptcli icon indicating copy to clipboard operation
gptcli copied to clipboard

extglob support for gptcli command

Open huwan opened this issue 3 years ago • 1 comments

The gptcli command uses /bin/sh as the default shell to execute commands. However, when some commands require the use of "extglob" extensions, they cannot be executed. Here's an example.

$ gptcli command "make five 5 folders and 3 files"
❯ mkdir folder1 folder2 folder3 folder4 folder5 && touch file1.txt file2.txt file3.txt

$ ls
file1.txt  file2.txt  file3.txt  folder1  folder2  folder3  folder4  folder5
$ gptcli command "move all folders except folder4 and folder5 to folder5"
❯ mv !(folder4|folder5) folder5
? execute the command above ⬆️ ?  Yes
/bin/sh: 1: Syntax error: "(" unexpected

If I enable the shopt -s extglob in bash, and run the same commnad manully, it works fine.

$ mv !(folder4|folder5) folder5
$ ls
folder4  folder5

huwan avatar Mar 30 '23 15:03 huwan

@huwan Thank you very much for your feedback. I will handle this issue.

JohannLai avatar Mar 31 '23 02:03 JohannLai