Skip to content

Commit

Permalink
Merge pull request #31 from dbeuchler/master
Browse files Browse the repository at this point in the history
Fixed loading of possible generators in FileMode
  • Loading branch information
Toxantron committed Dec 21, 2016
2 parents 1d2cd6e + 8183998 commit 5325c00
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CGbR.sln
Expand Up @@ -11,6 +11,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CGbR.Lib", "CGbR.Lib\CGbR.L
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CGbR.Runner", "CGbR.Runner\CGbR.Runner.csproj", "{2E6CD21F-17F3-4678-8F4A-E26C933BB373}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{ECA90016-B75E-4A72-8FCD-D5F38DF9E7A1}"
ProjectSection(SolutionItems) = preProject
README.md = README.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
4 changes: 4 additions & 0 deletions CGbR/Modes/FileMode.cs
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.IO;
using System.Reflection;

namespace CGbR
{
Expand All @@ -24,6 +25,9 @@ public override bool Initialize(string path, string[] args)
var ext = Path.GetExtension(_path);
Parsers[ext] = ParserFactory.Resolve(args[0]);

// Load generators
GeneratorFactory.Initialize(new[] {Assembly.GetExecutingAssembly()});

// All following arguments are the active generators
for (var i = 1; i < args.Length; i++)
{
Expand Down
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -34,8 +34,8 @@ targets. Choice is made automatically based on the first argument. For filepathe
".csproj" or ".sln" file in the given path.

### File Mode
In the File Mode CGbR operators on a single file only. Instead of a configuration it requires a couple of arguments. The first
argument is obviously the file. Next cames the name of the parser and all following arguments are interpreted as generator names.
In the File Mode CGbR operates on a single file only. Instead of a configuration it requires a couple of arguments. The first
argument is obviously the file path. Next cames the name of the parser and all following arguments are interpreted as generator names.
_Right now it does not support extension libraries_.
This might look like this: `$ cgbr.exe Messages/MyMessage.cs Regex BinarySerializer`

Expand Down

0 comments on commit 5325c00

Please sign in to comment.