Argument Query get all

Asked Nov 21, 2023·2 replies·Last activity 2 years ago·Open in Discord ↗
Archived from the original community forum
Things may have changed since it was written. Still stuck? Ask the community on Discord.

Hey there.

Currently I have this:

$(eval '$(1)' === 'null' ? 'https://testlink.com/market' : 'Market for $(1): https://testlink.com/market?filter=$(1)')

But what I want is people to be able to type more than one word.
I want the command to fetch all and seperate them by +
So the link would look like:

https://testlink.com/market?filter=Argument1+Argument2+Argument3

Can someone pls help fitting this into the command :) ?

2 replies

Hey @Patient Crab!

Replace $(1) with $(query), then replace $(query)'s spaces with +:

$(eval const q = '$(query)'.replace(/\s/g, '+'); q === '' ? 'https://testlink.com/market' : `Market for $(query): https://testlink.com/market?filter=${q}`)

Thank you Emily!
Especially const q = '$(query)'.replace(/\s/g, '+'); q === '' was very very helpful! Thank you a lot.