🦊 Sharp
A collection of F# modules.
Each module/file is made to be used with Paket's GitHub dependencies feature.
Path environment
Parse and expose both PATH and PATHEXT environment variables and allow to find an executable with the same rules as the shell.
path: Lazy<string list>
: Directories in the system PATH.pathExt: Lazy<string list>
Extensions considered executables by the system. Parsed fromPATHEXT
on windows and always return[""]
on other systems.findInPathOnly: string -> string option
: Find an executable inPATH
(Extension is optional if present inPATHEXT
)find: string -> string option
: Find an executable in the current directory orPATH
(Extension is optional if present inPATHEXT
)
Example:
open BlackFox.PathEnvironment
match find "node" with
| None -> failwith "nodejs wasn't found"
| nodePath -> // ...
Paket: github vbfox/FoxSharp src/BlackFox.FoxSharp/PathEnvironment.fs
Command line
Generate, parse and escape command lines.
The MsvcrCommandLine
module is specific to the way the Microsoft C Runtime algorithm works on Windows. It's how the vast majority of arguments are parsed on the Windows platform.
escape: seq<string> -> string
: Escape arguments in a form that programs parsing it as Microsoft C Runtime will successfuly understand.parse: string -> string list
: Parse a string representing arguments as the Microsoft C Runtime does.
The CmdLine
record and module implement a simple, pipable API to generate command lines.
empty: CmdLine
: Represents an empty command lineappendRaw: CmdLine -> string -> CmdLine
: Add a part of the command line that won't be escapedappendRawIfSome: CmdLine -> string option -> CmdLine
concat: CmdLine -> CmdLine -> CmdLine
: Concat 2 command linesappend: CmdLine -> string -> CmdLine
: Append an argument to the command lineappendSeq: CmdLine -> seq<string> -> CmdLine
: Append arguments to the command lineappendIfTrue: CmdLine -> bool -> string -> CmdLine
: Append arguments to the command line if the condition is trueappendIfSome: CmdLine -> string option -> CmdLine
appendSeqIfSome: CmdLine -> string list option -> CmdLine
appendIfNotNullOrEmpty: CmdLine -> string -> string -> CmdLine
toStringForMsvcr: CmdLine -> string
toString: CmdLine -> string
: Transform the command line into a string, escaping as needed by the current OS/Framework forProcess.Start
.fromSeq: seq<string> -> CmdLine
: Create a command line from a sequence of arguments
Paket: github vbfox/FoxSharp src/BlackFox.FoxSharp/CommandLine.fs
FAKE Tasks
A replacement for FAKE Target
using a syntax similar to Gulp
Examples:
open BlackFox.TaskDefinitionHelper
// A task with no dependencies
Task "Clean" [] (fun _ ->
// ...
)
// Another one, defined with the computation expression
task "PaketRestore" [] {
// ...
}
// A task that need the restore to be done and should run after Clean
// if it is in the build chain
task "Build" ["?Clean";"PaketRestore"] {
// ...
}
EmptyTask "CI" ["Clean";"PaketRestore"]
RunTaskOrDefault "Build"
Paket: github vbfox/FoxSharp src/BlackFox.FakeUtils/TaskDefinitionHelper.fs
FAKE Typed tasks
A replacement for FAKE Target
using a syntax similar to Gulp with no string in
dependency definitions.
Examples:
open BlackFox.TypedTaskDefinitionHelper
// A task with no dependencies
let clean = Task "Clean" [] (fun _ ->
// ...
)
// Another one, defined with the computation expression
let paketRestore = task "PaketRestore" [] {
// ...
}
// A task that need the restore to be done and should run after Clean
// if it is in the build chain
let build = task "Build" [clean.IfNeeded;paketRestore] {
// ...
}
let _ci = EmptyTask "CI" [clean;build]
RunTaskOrDefault build
Paket: github vbfox/FoxSharp src/BlackFox.FakeUtils/TypedTaskDefinitionHelper.fs