mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-08-01 08:18:20 -04:00
Allows us to get rid of a ton of abstraction in SboxBuild, and gets rid of a lot of GitHub API plumbing. I feel like now that our workflows are more complex it's nicer to just use GitHub directly rather than having our own pipeline abstraction in SboxBuild. This way we get nicer logging and error reporting, which we can\t achieve through GitHub API.
31 lines
684 B
C#
31 lines
684 B
C#
using static Facepunch.Constants;
|
|
|
|
namespace Facepunch.Steps;
|
|
|
|
internal class Format( Constants.Solutions solution, Format.Mode mode = Format.Mode.Full, bool verifyOnly = false )
|
|
{
|
|
public enum Mode
|
|
{
|
|
Full = 0,
|
|
Whitespace = 1,
|
|
}
|
|
|
|
internal ExitCode Run()
|
|
{
|
|
var solutionDir = Constants.GetSolutionDir( solution );
|
|
|
|
var modeArgs = mode == Mode.Whitespace ? "whitespace --folder" : "";
|
|
if ( verifyOnly )
|
|
{
|
|
modeArgs += " --verify-no-changes";
|
|
}
|
|
if ( !Utility.RunDotnetCommand( solutionDir, $"format {modeArgs}" ) )
|
|
{
|
|
return ExitCode.Failure;
|
|
}
|
|
|
|
Log.Error( $"Format completed successfully for {solution} in mode {mode}" );
|
|
return ExitCode.Success;
|
|
}
|
|
}
|