@@ -277,6 +277,97 @@ func (s CppStandard) Label() string {
277277 return "C++" + string (s )
278278}
279279
280+ // ─────────────────────────────────────────────────────────────────────────────
281+
282+ // ClangFormatStyle represents the base style for .clang-format generation.
283+ // When set to ClangFormatLLVM, a fully customized template with modern
284+ // overrides is generated. For all other styles, a minimal file with just
285+ // BasedOnStyle and Standard is generated, allowing the user to build on top.
286+ type ClangFormatStyle string
287+
288+ const (
289+ // ClangFormatLLVM generates a detailed .clang-format based on LLVM with
290+ // modern adjustments: 4-space indent, Allman braces, 100-col limit, etc.
291+ // This is the default and matches the historical behaviour of cpp-gen.
292+ ClangFormatLLVM ClangFormatStyle = "LLVM"
293+
294+ // ClangFormatGoogle uses the Google C++ Style Guide as-is (2-space indent,
295+ // K&R braces, 80-col limit).
296+ ClangFormatGoogle ClangFormatStyle = "Google"
297+
298+ // ClangFormatChromium is based on Google style, used by the Chromium project.
299+ ClangFormatChromium ClangFormatStyle = "Chromium"
300+
301+ // ClangFormatMozilla uses the Mozilla coding style.
302+ ClangFormatMozilla ClangFormatStyle = "Mozilla"
303+
304+ // ClangFormatWebKit uses the WebKit coding style (4-space indent, K&R braces).
305+ ClangFormatWebKit ClangFormatStyle = "WebKit"
306+
307+ // ClangFormatMicrosoft uses the Microsoft C++ coding style.
308+ ClangFormatMicrosoft ClangFormatStyle = "Microsoft"
309+
310+ // ClangFormatGNU uses the GNU coding standards.
311+ ClangFormatGNU ClangFormatStyle = "GNU"
312+ )
313+
314+ // ClangFormatStyleOptions returns all available styles in suggested order.
315+ func ClangFormatStyleOptions () []ClangFormatStyle {
316+ return []ClangFormatStyle {
317+ ClangFormatLLVM ,
318+ ClangFormatGoogle ,
319+ ClangFormatChromium ,
320+ ClangFormatMozilla ,
321+ ClangFormatWebKit ,
322+ ClangFormatMicrosoft ,
323+ ClangFormatGNU ,
324+ }
325+ }
326+
327+ // Label returns the user-friendly name for display in the TUI.
328+ func (s ClangFormatStyle ) Label () string {
329+ switch s {
330+ case ClangFormatLLVM :
331+ return "LLVM — personalizado (4 espaços, Allman, 100 cols)"
332+ case ClangFormatGoogle :
333+ return "Google — Google C++ Style Guide (2 espaços, 80 cols)"
334+ case ClangFormatChromium :
335+ return "Chromium — baseado em Google (Chromium project)"
336+ case ClangFormatMozilla :
337+ return "Mozilla — Mozilla Coding Style"
338+ case ClangFormatWebKit :
339+ return "WebKit — WebKit Coding Style (4 espaços)"
340+ case ClangFormatMicrosoft :
341+ return "Microsoft — Microsoft C++ Style"
342+ case ClangFormatGNU :
343+ return "GNU — GNU Coding Standards"
344+ default :
345+ return string (s )
346+ }
347+ }
348+
349+ // Description returns a short explanation shown as a hint in the TUI.
350+ func (s ClangFormatStyle ) Description () string {
351+ switch s {
352+ case ClangFormatLLVM :
353+ return "Arquivo detalhado com todas as opções documentadas. Fácil de ajustar."
354+ case ClangFormatGoogle :
355+ return "Estilo oficial do Google. Amplamente adotado em projetos open source."
356+ case ClangFormatChromium :
357+ return "Derivado do Google Style. Usado no projeto Chromium e projetos relacionados."
358+ case ClangFormatMozilla :
359+ return "Estilo oficial da Mozilla Foundation."
360+ case ClangFormatWebKit :
361+ return "Estilo usado pelo motor de layout WebKit (Safari, Qt WebEngine)."
362+ case ClangFormatMicrosoft :
363+ return "Estilo padrão de projetos Microsoft (Visual Studio)."
364+ case ClangFormatGNU :
365+ return "Padrões de codificação GNU. Comum em projetos do ecossistema GNU/Linux."
366+ default :
367+ return ""
368+ }
369+ }
370+
280371// ─────────────────────────────────────────────────────────────────────────────
281372// Main configuration structure
282373// ─────────────────────────────────────────────────────────────────────────────
@@ -330,6 +421,11 @@ type ProjectConfig struct {
330421 // UseClangFormat indicates whether the .clang-format file should be generated.
331422 UseClangFormat bool
332423
424+ // ClangFormatStyle defines the base style used for .clang-format generation.
425+ // When set to ClangFormatLLVM, a fully customized template is generated.
426+ // For all other values, a minimal BasedOnStyle file is generated.
427+ ClangFormatStyle ClangFormatStyle
428+
333429 // ── Output configuration ──────────────────────────────────────────────────
334430
335431 // OutputDir is the base directory where the project will be created.
@@ -375,15 +471,16 @@ func (c *ProjectConfig) Validate() []string {
375471// useful as a starting point before applying the user's choices.
376472func Default () * ProjectConfig {
377473 return & ProjectConfig {
378- Version : "1.0.0" ,
379- Standard : Cpp20 ,
380- ProjectType : TypeExecutable ,
381- Layout : LayoutSeparate ,
382- PackageManager : PkgNone ,
383- IDE : IDENone ,
384- UseGit : true ,
385- UseClangd : true ,
386- UseClangFormat : true ,
387- OutputDir : "." ,
474+ Version : "1.0.0" ,
475+ Standard : Cpp20 ,
476+ ProjectType : TypeExecutable ,
477+ Layout : LayoutSeparate ,
478+ PackageManager : PkgNone ,
479+ IDE : IDENone ,
480+ UseGit : true ,
481+ UseClangd : true ,
482+ UseClangFormat : true ,
483+ ClangFormatStyle : ClangFormatLLVM ,
484+ OutputDir : "." ,
388485 }
389486}
0 commit comments