Owl.cli 0.0.3

dotnet add package Owl.cli --version 0.0.3
NuGet\Install-Package Owl.cli -Version 0.0.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Owl.cli" Version="0.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Owl.cli --version 0.0.3
#r "nuget: Owl.cli, 0.0.3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Owl.cli as a Cake Addin
#addin nuget:?package=Owl.cli&version=0.0.3

// Install Owl.cli as a Cake Tool
#tool nuget:?package=Owl.cli&version=0.0.3

img

🔷 Owl.cli

Owl.cli is a library to facilitate the use of shell from F#. This library allows you to execute commands while also retrieving the results. It is characterized by the ability to execute commands continuously while preserving context.

🔹 Usage

1️⃣ cmd computation expression

▫️ exec custom op : string → string

Execute the command passed to exec and receive the result. Use into to receive the results.

open Owl.cli.cmd

use builder = cmd () {
  exec @"cd C:\"
  exec @"dir .\" into r
  printfn $"%s{r}"
}
▫️ exit custom op : unit → ShellBuilder

Explicitly terminates the cmd. If exit is not called, the cmd also exits when the ShellBuilder is disposed.

open Owl.cli.cmd

use builder = cmd () {
  exec @"cd C:\"
  exec @"dir .\"
  exit
}
▫️ results property : array<Output>

Obtain a pair of executed commands and their results.

open Owl.cli.cmd

use builder = cmd () {
  exec @"cd C:\"
  exec @"dir .\"
  exit
}

builder.results |> Array.iter (printfn "%A")

2️⃣ powershell computation expression (LEGACY PowerShell)

▫️ exec custom op : string → string

Execute the command passed to exec and receive the result. Use into to receive the results

open Owl.cli.powershell

use builder = powershell () {
  exec @"cd C:\"
  exec @"ls .\" into r
  printfn $"%s{r}"
}
▫️ exit custom op : unit → ShellBuilder

Explicitly terminates the powershell. If exit is not called, the powershell also exits when the ShellBuilder is disposed.

open Owl.cli.powershell

use builder = powershell () {
  exec @"cd C:\"
  exec @"ls .\"
  exit
}
▫️ results property : array<Output>

Obtain a pair of executed commands and their results.

open Owl.cli.powershell

use builder = powershell () {
  exec @"cd C:\"
  exec @"ls .\"
  exit
}

builder.results |> Array.iter (printfn "%A")

3️⃣ pwsh computation expression (PowerShell Core)

▫️ exec custom op : string → string

Execute the command passed to exec and receive the result. Use into to receive the results.

open Owl.cli.pwsh

use builder = pwsh () {
  exec "cd /bin"
  exec "ls ./" into r
  printfn $"%s{r}"
}
▫️ exit custom op : unit → ShellBuilder

Explicitly terminates the pwsh. If exit is not called, the pwsh also exits when the ShellBuilder is disposed.

open Owl.cli.pwsh

use builder = pwsh () {
  exec "cd /bin"
  exec "ls ./"
  exit
}
▫️ results property : array<Output>

Obtain a pair of executed commands and their results.

open Owl.cli.pwsh

use builder = pwsh () {
  exec "cd /bin"
  exec "ls ./"
  exit
}

builder.results |> Array.iter (printfn "%A")

4️⃣ zsh computation expression

▫️ exec custom op : string → string

Execute the command passed to exec and receive the result. Use into to receive the results.

open Owl.cli.zsh

use builder = zsh () {
  exec "cd /bin"
  exec "ls ./" into r
  printfn $"%s{r}"
}
▫️ exit custom op : unit → ShellBuilder

Explicitly terminates the zsh. If exit is not called, the zsh also exits when the ShellBuilder is disposed.

open Owl.cli.zsh

use builder = zsh () {
  exec "cd /bin"
  exec "ls ./"
  exit
}
▫️ results property : array<Output>

Obtain a pair of executed commands and their results.

open Owl.cli.zsh

use builder = zsh () {
  exec "cd /bin"
  exec "ls ./"
  exit
}

builder.results |> Array.iter (printfn "%A")

5️⃣ bash computation expression

▫️ exec custom op : string → string

Execute the command passed to exec and receive the result. Use into to receive the results.

open Owl.cli.bash

use builder = bash () {
  exec "cd /bin"
  exec "ls ./" into r
  printfn $"%s{r}"
}
▫️ exit custom op : unit → ShellBuilder

Explicitly terminates the bash. If exit is not called, the bash also exits when the ShellBuilder is disposed.

open Owl.cli.bash

use builder = bash () {
  exec "cd /bin"
  exec "ls ./"
  exit
}
▫️ results property : array<Output>

Obtain a pair of executed commands and their results.

open Owl.cli.bash

use builder = bash () {
  exec "cd /bin"
  exec "ls ./"
  exit
}

builder.results |> Array.iter (printfn "%A")

6️⃣ cli computation expression

Warning cli will be a generic implementation of CE. Some shells such as 'cmd' will not be handled correctly because the base of behavior will be 'zsh' or 'bash' equivalent.

▫️ exec custom op : string → string

Execute the command passed to exec and receive the result. Use into to receive the results.

open Owl.cli.general

use builder = cli "/bin/zsh" {
  exec "cd /bin"
  exec "ls ./" into r
  printfn $"%s{r}"
}
▫️ exit custom op : unit → ShellBuilder

Explicitly terminates the cli. If exit is not called, the cli also exits when the ShellBuilder is disposed.

open Owl.cli.general

use builder = cli () {
  exec "cd /bin"
  exec "ls ./"
  exit
}
▫️ results property : array<Output>

Obtain a pair of executed commands and their results.

open Owl.cli.general

use builder = cli () {
  exec "cd /bin"
  exec "ls ./"
  exit
}

builder.results |> Array.iter (printfn "%A")
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.0.3 148 5/24/2023
0.0.2 175 3/20/2023
0.0.1.1 195 3/14/2023
0.0.1 174 3/14/2023