BomSweeper.GlobalTool 2.0.0

dotnet tool install --global BomSweeper.GlobalTool --version 2.0.0                
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest # if you are setting up this repo
dotnet tool install --local BomSweeper.GlobalTool --version 2.0.0                
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=BomSweeper.GlobalTool&version=2.0.0                
nuke :add-package BomSweeper.GlobalTool --version 2.0.0                

BomSweeper

BomSweeper is a command-line tool that finds the files starting with a UTF-8 Byte Order Mark (BOM) in the directory tree and removing a BOM from those files.

Requirements

Get started

BomSweeper is available as the NuGet Package, so it can be installed as follows:

dotnet tool install -g BomSweeper.GlobalTool

Synopsis

bomsweeper [-C DIR] [-D N] [-RVhv] [--] PATTERN...

Description

The PATTERN arguments represent the glob patterns that match the paths of the files to find.

The path separator in the pattern must be a slash ('/') character regardless of the platform. The directory names . and .. in the pattern are not interpreted specially (that is, . and .. do not mean the current and parent directory, respectively). So, for example, the pattern foo/../bar/baz.cs does not match bar/baz.cs.

Note that the pattern matching is performed with the relative paths to the current directory, so if the pattern starts with a slash, it does not match any file.

The pattern can contain an asterisk ('*') character as a wildcard, which matches any character other than a slash zero or more times. It can also contain a double asterisk ('**'), which represents as follows:

  • if the pattern equals **, it matches all files in the current directory and in its subdirectories.

  • if the pattern ends with /** (a slash followed by a double asterisk), the subpattern /** matches all files in the directory and subdirectories.

  • if the pattern starts with **/ (a double asterisk followed by a slash), the subpattern **/ matches the current directory and its subdirectories. For example, **/foo matches foo, bar/foo, and bar/baz/foo.

  • if the pattern contains /**/, the subpattern /**/ matches a slash, the directories, and subdirectories. For example, foo/**/bar matches foo/bar, foo/baz/bar, and foo/baz/qux/bar.

Options are as follows:

Option Description
-C, --directory DIR Change to directory. (Default: .)
-h, --help Show help message and exit
-D, --max-depth N The maximum number of directory levels to search. (Default: 16)
-R, --remove Remove a BOM
-v, --verbose Be verbose
-V, --version Show version and exit

Exit status

BomSweeper exits 0 if no files starting with a UTF-8 BOM are found, and >0 if one or more files are found or if an error occurs.

When the -R or --remove option is specified, it exits 0 on success, and >0 if an error occurs.

Example

Note that, in the following examples, the glob pattern is enclosed in apostrophes ('...') to prevent the shell from expanding the pattern.

bomsweeper '**/*.cs'

Find .cs files starting with a UTF-8 BOM in the current directory and subdirectories.

bomsweeper -R '**/*.cs'

Find .cs files in the current directory and subdirectories, and remove a UTF-8 BOM from the files if any.

How to build

Requirements to build

Build with .NET Core SDK

git clone URL
cd BomSweeper.CSharp
dotnet restore
dotnet build

Get test coverage report with Coverlet

dotnet test -p:CollectCoverage=true -p:CoverletOutputFormat=opencover \
        --no-build BomSweeper.Test
dotnet ANYWHERE/reportgenerator.dll \
        --reports:BomSweeper.Test/coverage.opencover.xml \
        --targetdir:Coverlet-html

Install BomSweeper as a Global Tool

cd BomSweeper.GlobalTool
dotnet pack
dotnet tool install --global --add-source bin/Debug BomSweeper.GlobalTool
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last updated
2.0.0 90 12/1/2024
1.0.1 1,006 6/1/2020
1.0.0 1,260 4/29/2019