4
4
5
5
namespace Butschster \ContextGenerator \Console ;
6
6
7
+ use Butschster \ContextGenerator \Application \JsonSchema ;
7
8
use Butschster \ContextGenerator \Config \ConfigType ;
9
+ use Butschster \ContextGenerator \Config \Registry \ConfigRegistry ;
8
10
use Butschster \ContextGenerator \Directories ;
9
11
use Butschster \ContextGenerator \Document \Document ;
10
12
use Butschster \ContextGenerator \Document \DocumentRegistry ;
@@ -51,7 +53,11 @@ public function __invoke(Directories $dirs, FilesInterface $files): int
51
53
return Command::FAILURE ;
52
54
}
53
55
54
- $ content = new DocumentRegistry ([
56
+ $ config = new ConfigRegistry (
57
+ schema: JsonSchema::SCHEMA_URL ,
58
+ );
59
+
60
+ $ config ->register (new DocumentRegistry ([
55
61
new Document (
56
62
description: 'Project structure overview ' ,
57
63
outputPath: 'project-structure.md ' ,
@@ -62,13 +68,13 @@ public function __invoke(Directories $dirs, FilesInterface $files): int
62
68
),
63
69
),
64
70
),
65
- ]);
71
+ ])) ;
66
72
67
73
try {
68
74
$ content = match ($ type ) {
69
- ConfigType::Json => \json_encode ($ content , JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ),
75
+ ConfigType::Json => \json_encode ($ config , JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ),
70
76
ConfigType::Yaml => Yaml::dump (
71
- \json_decode (\json_encode ($ content ), true ),
77
+ \json_decode (\json_encode ($ config ), true ),
72
78
10 ,
73
79
2 ,
74
80
Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK ,
0 commit comments