Azure / azure-cli

Azure Command-Line Interface
MIT License
4.01k stars 2.98k forks source link

Feature request: regexp patterns #5576

Open elibarzilay opened 6 years ago

elibarzilay commented 6 years ago

IIUC, all az storage blob commands that take a --pattern argument use it as a globbing pattern, and there is no way to specify an actual regexp. Having also a regexp option would be much more useful.

williexu commented 6 years ago

related to https://github.com/Azure/azure-cli/issues/5420

sato-s commented 5 years ago

I really need this feature.

I am running CI for azure static website.
To upload my website, i'm using az stotage blob upload-batch.
The CI command is something like the following.

az storage blob upload-batch -s "." -d '$web'

But, above command uploads not only my html/css/js but also ./git, package.js etc... which I should not upload.

With regexp pattern, I can do something like this.

az storage blob upload-batch -s "." -d '$web' --pattern '\.css|\.js|\.html'
limingu commented 5 years ago

We do support --parttern with some regexp.

--pattern : The pattern used for globbing files or blobs in the source. The supported patterns are '*', '?', '[seq]', and '[!seq]'.

For the case that need to update only html/css/js, you can do 3 commands like: az storage blob upload-batch -s "." -d '$web' --pattern .html az storage blob upload-batch -s "." -d '$web' --pattern .css az storage blob upload-batch -s "." -d '$web' --pattern *.js

elibarzilay commented 5 years ago

@limingu, I opened this issue specifically about regexps, which are far more useful than the globbing patterns which you're pointing at.

limingu commented 5 years ago

Feature request to support regexps.

yonzhan commented 4 years ago

add to S165.

Juliehzl commented 4 years ago

@elibarzilay May I know which kind of scenario you want to support for regexp pattern? Can you show me an example for the usage?

elibarzilay commented 4 years ago

@Juliehzl, I moved away from the project where I needed this, so I don't remember exactly what I needed it for -- but one example would be an operation on files with a suffix of foo or bar: if there are only glob patterns, then such things must be done in two operations and since the time overhead for each use is high, the result is much slower.