Fsharp/FAKE中的双感叹号(!!)是什么? [英] What does a double exclamation mark (!!) in Fsharp / FAKE?

查看:66
本文介绍了Fsharp/FAKE中的双感叹号(!!)是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了以下代码,无法理解双感叹号提供的操作.该代码片段来自CICD系统中使用的FAKE脚本. Microsoft的符号和运算符参考没有列出此运算符,也无法在 FAKE的API参考中找到.

I've come across the following code and can not understand what operation the double exclamation marks provide. This code-snipet is from a FAKE script used in a CICD system. Microsoft's Symbol and Operator Reference does not list this operator, nor can I find it in FAKE's API Reference.

  !! (projectPackagePath + "/*.zip")
    |> Seq.iter(fun path ->
      trace ("Removing " + path)
      ShellExec tfCommand ("delete " + path + " /noprompt")

另一个用法示例

let buildLabelFiles = 
    !!(labelPath @@ "*.txt")

推荐答案

!!运算符采用文件模式,并返回与该模式匹配的文件的集合.

The !! operator takes a file pattern and returns a collection of files matching the pattern.

例如,如果要打印当前文件夹中的所有文本文件,可以编写:

For example, if you want to print all text files in the current folder, you can write:

for file in !! "*.txt" do
  printfn "%s" file

如果您查看源代码中的运算符定义,您可以看到它只是用于创建IGlobbingPattern值的别名(请参见

If you look at the operator definition in the source code, you can see that it is just an alias for creating a IGlobbingPattern value (see the type definition) that includes files given by the specified pattern. The IGlobbingPattern type implements IEnumerable, so you can iterate over the files, but you can do a couple of other things with IGlobbingPattern such as combining two file sets using ++ or removing some files from a file set using --.

这篇关于Fsharp/FAKE中的双感叹号(!!)是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆