FsShell 0.0.3
.NET 6.0
This package targets .NET 6.0. The package is compatible with this framework or higher.
.NET Standard 2.1
This package targets .NET Standard 2.1. The package is compatible with this framework or higher.
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package FsShell --version 0.0.3
NuGet\Install-Package FsShell -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="FsShell" Version="0.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FsShell" Version="0.0.3" />
<PackageReference Include="FsShell" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add FsShell --version 0.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: FsShell, 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.
#:package FsShell@0.0.3
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=FsShell&version=0.0.3
#tool nuget:?package=FsShell&version=0.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
FsShell
List of Shell-like commands for use in F#.
Caveat
These commands are NOT intended for projects with a long life. It is recommended that this only be used in the FSI or for short fire-and-forget utilities. As I eat my own dog food and become more proficient in idiomatic F#, some things might change.
Usage
#r "nuget:FsShell"
open FsShell
man "";;
All functions are in FsShell.fs
System
cd Change directory
pwd Print working directory
mkdir Make directory
mv Move file
cp Copy file
ls List
ll List with details (fullname * size * FileInfo)
find Find files
find_p Find folders
Output
stdout Output to STDOUT
stderr Output to STDERR
write Output to a file
append Append to a file
tee Output to a file and passthrough
tee_a Append to a file and passthrough
cat Read a list of files consecutively
Data Manipulation
NOTE: these will create seq<string list> that aren't friendly with other commands
cut Split lines at tabs
cut_d Split lines at delimeter
cut_c Cut character range options
cut_c2 Cut character ranges
cutx Splits data file into columns
Data Flow
grep Filter lines to include
grep_i Filter lines to include, case insensitive
egrep Filter lines to include with regex
egrep_i Filter lines to include with regex, case insensitive
grep_n Filter lines to exclude
grep_in Filter lines to exclude, case insensitive
egrep_n Filter lines to exclude with regex
egrep_in Filter lines to exclude with regex, case insensitive
head_n First count lines
head First 10 lines
tail_n Last count lines, or skip first count of lines
tail Last 10 lines
Miscellaneous
man This
Examples
Manipulating Folders
> mkdir "test_fsshell";;
val it: string = "/Users/gregh/Projects/test_fsshell"
> cd "test_fsshell";;
val it: string = "/Users/gregh/Projects/test_fsshell"
> pwd ();;
val it: string = "/Users/gregh/Projects/test_fsshell"
Manipulating Files
> // write to output lines to files
- // newlines are added and stripped automatically
- seq {
- "My First Line"
- "My Second Line"
- }
- |> write "file1.txt"
- ;;
val it: unit = ()
> // cat and grep
- cat [ "file1.txt" ]
- |> grep_i "second"
- |> write "file2.txt"
- ;;
val it: unit = ()
> cat [ "file1.txt"; "file2.txt" ];;
val it: seq<string> =
seq ["My First Line"; "My Second Line"; "My Second Line"]
Manipulating Data
> seq { "A\tB"; "C\tD" } |> write "file1.txt";;
val it: unit = ()
> cat [ "file1.txt" ]
- |> cut
- ;;
val it: seq<string list> = seq [["A"; "B"]; ["C"; "D"]]
> // also available is cut_d to split on a provided delimiter
- // cut_c and cut_c2 to get specific character ranges
> // cutx for handling CSV data files
- cat [ "./datafile.csv" ]
- |> cutx
- ;;
val it: seq<string array> =
seq
[[|"Column 1"; "Column 2"; "Column 3"|];
[|"Val 1-1"; "Val 2-1"; "Val 3-1"|];
[|"Val 1-2"; "Val 2-2"; "Val 3-2"|];
[|"Val 1-3"; "Val 2-3"; "Val 3-3"|]]
Miscellaneous
"Why no rm and rmdir?"
I could see this going badly, quickly. Maybe I'll change my mind later, but after implementing it, I felt it was too dangerous.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. 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 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.1
- FSharp.Core (>= 7.0.200)
-
net6.0
- FSharp.Core (>= 7.0.200)
-
net7.0
- FSharp.Core (>= 7.0.200)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.