Giter VIP home page Giter VIP logo

format's Introduction

dotnet-format

Nuget

MyGet

Branch Windows (Debug) Windows (Release) Linux (Debug) Linux (Release) Localization (Debug) Localization (Release)
master Build Status Build Status Build Status Build Status Build Status Build Status

dotnet-format is a code formatter for dotnet that applies style preferences to a project or solution. Preferences will be read from an .editorconfig file, if present, otherwise a default set of preferences will be used. At this time dotnet-format is able to format C# and Visual Basic projects with a subset of supported .editorconfig options.

How To Install

The dotnet-format nuget package is published to nuget.org.

You can install the tool using the following command.

dotnet tool install -g dotnet-format

Installing Development Builds

Development builds of dotnet-format are being hosted on myget. You can visit the dotnet-format myget page to get the latest version number.

You can install the tool using the following command.

dotnet tool install -g dotnet-format --version 3.0.0-prerelease.19119.4 --add-source https://dotnet.myget.org/F/format/api/v3/index.json

How To Use

By default dotnet-format will look in the current directory for a project or solution file and use that as the workspace to format. If more than one project or solution file is present in the current directory you will need to specify the workspace to format using the -w option. You can control how verbose the output will be by using the -v option.

Usage:
  dotnet-format [options]

Options:
  -w, --workspace    The solution or project file to operate on. If a file is not specified, the command will search
                     the current directory for one.
  -v, --verbosity    Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and
                     diag[nostic]
  --dry-run          Format files, but do not save changes to disk.
  --check            Terminate with non-zero exit code if any files need to be formatted in the workspace.
  --files            The files to operate on. If none specified, all files in workspace will be operated on.
  --version          Display version information

Add format after dotnet and before the command arguments that you want to run:

Examples
dotnet format
dotnet format -w <workspace>
dotnet format -v diag
dotnet format -w <workspace> -v diag

How To Uninstall

You can uninstall the tool using the following command.

dotnet tool uninstall -g dotnet-format

How To Build From Source

You can build and package the tool using the following commands. The instructions assume that you are in the root of the repository.

build -pack
# The final line from the build will read something like
# Successfully created package '..\artifacts\packages\Debug\Shipping\dotnet-format.3.0.0-dev.nupkg'.
# Use the value that is in the form `3.0.0-dev` as the version in the next command.
dotnet tool install --add-source .\artifacts\packages\Debug\Shipping -g dotnet-format --version <version>
dotnet format

Note: On macOS and Linux, .\artifacts will need be switched to ./artifacts to accommodate for the different slash directions.

format's People

Contributors

aarnott avatar adamcaviness avatar alexperovich avatar chcosta avatar cshung avatar dagood avatar dotnet-maestro-int[bot] avatar dotnet-maestro[bot] avatar github-john-doe avatar itn3000 avatar jmarolf avatar joerobich avatar johntortugo avatar jonfortescue avatar markwilkie avatar mmitche avatar riarenas avatar roman-petrov avatar tmat avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.