pet icon indicating copy to clipboard operation
pet copied to clipboard

escape "<" char from command line

Open xp-1000 opened this issue 6 years ago • 2 comments

Hello,

Thanks for your work, I installed and tested pet from today only and it seems very promising.

I did not find the way to escape "special" char when adding new command.

Imagine this snippet :

  description = "List RDS snapshots older than <date> from <profile> for <region>"
  command = "aws --profile <profile> rds describe-db-snapshots --region <region> --query 'DBSnapshots[?SnapshotCreateTime<=`<date>`]'"

The problem is that <= starts a new parameter whereas it is part of the command (not a variable like "date").

May be someone know how to escape first < ?

thanks

xp-1000 avatar May 28 '19 15:05 xp-1000

I use pet to generate parameterized sql queries and had to work around this by replacing all occurrences of <= with < but would love to avoid that.

artloder avatar Jun 28 '19 12:06 artloder

I would prefer lower cased shell environment variables. Then you can use normal escaping rules.

brandonkal avatar Mar 18 '20 13:03 brandonkal

I just started using the superpet fork of pet and it seems to fix this issue. Or at least, it doesn't interpret '<=' as a parameter. https://github.com/RamiAwar/superpet

(no offense to pet, I love it! And superpet is just pet with a few extra fixes)

edit: I would still love to be able to escape a '<' though. Superpet doesn't let you do that either. But superpet does more narrowly and more correctly parse out what's supposed to be a parameter and what's part of your actual command.

varenc avatar Nov 17 '22 21:11 varenc

Hey! Developer of superpet here, I fixed this issue in Pet now. I'm maintaining pet nearly every day nowadays so expect a lot more improvements! The new regex pattern captures this properly I believe.

@varenc @xp-1000

image

RamiAwar avatar Feb 20 '24 10:02 RamiAwar