-
-
Notifications
You must be signed in to change notification settings - Fork 271
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#384: Added warning for unknown or duplicate command line arguments
- Loading branch information
1 parent
cbbe7a0
commit 16ca983
Showing
19 changed files
with
343 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
src/ReportGenerator.Core.Test/ReportGenerator.Core.Test.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Reflection; | ||
|
||
namespace Palmmedia.ReportGenerator.Core | ||
{ | ||
/// <summary> | ||
/// Name of the command line arguments. | ||
/// </summary> | ||
internal static class CommandLineArgumentNames | ||
{ | ||
/// <summary> | ||
/// The reports. | ||
/// </summary> | ||
public const string Reports = "REPORTS"; | ||
|
||
/// <summary> | ||
/// The target directory. | ||
/// </summary> | ||
public const string TargetDirectory = "TARGETDIR"; | ||
|
||
/// <summary> | ||
/// The source directories. | ||
/// </summary> | ||
public const string SourceDirectories = "SOURCEDIRS"; | ||
|
||
/// <summary> | ||
/// The history directory. | ||
/// </summary> | ||
public const string HistoryDirectory = "HISTORYDIR"; | ||
|
||
/// <summary> | ||
/// The report types. | ||
/// </summary> | ||
public const string ReportTypes = "REPORTTYPES"; | ||
|
||
/// <summary> | ||
/// Single report type (deprecated). | ||
/// </summary> | ||
public const string ReportType = "REPORTTYPE"; | ||
|
||
/// <summary> | ||
/// The plugins. | ||
/// </summary> | ||
public const string Plugins = "PLUGINS"; | ||
|
||
/// <summary> | ||
/// The assembly filters. | ||
/// </summary> | ||
public const string AssemblyFilters = "ASSEMBLYFILTERS"; | ||
|
||
/// <summary> | ||
/// The assembly filters (deprecated). | ||
/// </summary> | ||
public const string Filters = "FILTERS"; | ||
|
||
/// <summary> | ||
/// Single class filter. | ||
/// </summary> | ||
public const string ClassFilters = "CLASSFILTERS"; | ||
|
||
/// <summary> | ||
/// The file filters. | ||
/// </summary> | ||
public const string FileFilters = "FILEFILTERS"; | ||
|
||
/// <summary> | ||
/// The verbosity. | ||
/// </summary> | ||
public const string Verbosity = "VERBOSITY"; | ||
|
||
/// <summary> | ||
/// The title. | ||
/// </summary> | ||
public const string Title = "TITLE"; | ||
|
||
/// <summary> | ||
/// The tag. | ||
/// </summary> | ||
public const string Tag = "TAG"; | ||
|
||
/// <summary> | ||
/// All valid command line parameter names. | ||
/// </summary> | ||
private static readonly HashSet<string> ValidNames = new HashSet<string>( | ||
typeof(CommandLineArgumentNames) | ||
.GetFields(BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy) | ||
.Where(fi => fi.IsLiteral && !fi.IsInitOnly && fi.FieldType == typeof(string)) | ||
.Select(x => (string)x.GetRawConstantValue()) | ||
.ToList()); | ||
|
||
/// <summary> | ||
/// Gets a value indicating whether a command line parameter name is valid. | ||
/// </summary> | ||
/// <param name="name">The command line parameter name.</param> | ||
/// <returns><c>true</c> if command line parameter is valid; otherwise <c>false</c>.</returns> | ||
public static bool IsValid(string name) | ||
{ | ||
if (name == null) | ||
{ | ||
return false; | ||
} | ||
|
||
return ValidNames.Contains(name.ToUpperInvariant()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
namespace Palmmedia.ReportGenerator.Core | ||
{ | ||
/// <summary> | ||
/// Name of configuration elements in .netconfig files. | ||
/// </summary> | ||
public static class DotNetConfigSettingNames | ||
{ | ||
/// <summary> | ||
/// Name of the configuration section in a .netconfig file. | ||
/// </summary> | ||
public const string SectionName = "ReportGenerator"; | ||
|
||
/// <summary> | ||
/// The reports. | ||
/// </summary> | ||
public const string Reports = "reports"; | ||
|
||
/// <summary> | ||
/// Single report. | ||
/// </summary> | ||
public const string Report = "report"; | ||
|
||
/// <summary> | ||
/// The target directory. | ||
/// </summary> | ||
public const string TargetDirectory = "targetdir"; | ||
|
||
/// <summary> | ||
/// The source directories. | ||
/// </summary> | ||
public const string SourceDirectories = "sourcedirs"; | ||
|
||
/// <summary> | ||
/// Single source directory. | ||
/// </summary> | ||
public const string SourceDirectory = "sourcedir"; | ||
|
||
/// <summary> | ||
/// The history directory. | ||
/// </summary> | ||
public const string HistoryDirectory = "historydir"; | ||
|
||
/// <summary> | ||
/// The report types. | ||
/// </summary> | ||
public const string ReportTypes = "reporttypes"; | ||
|
||
/// <summary> | ||
/// Single report type. | ||
/// </summary> | ||
public const string ReportType = "reporttype"; | ||
|
||
/// <summary> | ||
/// The plugins. | ||
/// </summary> | ||
public const string Plugins = "plugins"; | ||
|
||
/// <summary> | ||
/// Single plugin. | ||
/// </summary> | ||
public const string Plugin = "plugin"; | ||
|
||
/// <summary> | ||
/// The assembly filters. | ||
/// </summary> | ||
public const string AssemblyFilters = "assemblyfilters"; | ||
|
||
/// <summary> | ||
/// Single assembly filter. | ||
/// </summary> | ||
public const string AssemblyFilter = "assemblyfilter"; | ||
|
||
/// <summary> | ||
/// The class filters. | ||
/// </summary> | ||
public const string ClassFilters = "classfilters"; | ||
|
||
/// <summary> | ||
/// Single class filter. | ||
/// </summary> | ||
public const string ClassFilter = "classfilter"; | ||
|
||
/// <summary> | ||
/// The file filters. | ||
/// </summary> | ||
public const string FileFilters = "filefilters"; | ||
|
||
/// <summary> | ||
/// Single file filter. | ||
/// </summary> | ||
public const string FileFilter = "filefilter"; | ||
|
||
/// <summary> | ||
/// The verbosity. | ||
/// </summary> | ||
public const string Verbosity = "verbosity"; | ||
|
||
/// <summary> | ||
/// The title. | ||
/// </summary> | ||
public const string Title = "title"; | ||
|
||
/// <summary> | ||
/// The tag. | ||
/// </summary> | ||
public const string Tag = "tag"; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.