PoC: flat and advanced mode

This commit is contained in:
2025-10-10 18:13:54 +02:00
commit 2b25bc17b3
14 changed files with 2040 additions and 0 deletions

181
templates/advanced.html Normal file
View File

@@ -0,0 +1,181 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Bash Argument Parser Generator - Subcommand Support</title>
<link rel="stylesheet" href="/static/css/style.css">
</head>
<body>
<div class="container">
<header>
<h1>Bash Argument Parser Generator</h1>
</header>
<!-- Mode Toggle -->
<div class="mode-toggle">
<button class="mode-btn active" data-mode="flat">
Flat Arguments
</button>
<button class="mode-btn" data-mode="subcommand">
Subcommands <span class="badge">NEW</span>
</button>
</div>
<section class="input-section">
<!-- Header Input -->
<div class="header-input">
<label for="custom-header">Custom Header / Greeting</label>
<input type="text" id="custom-header" placeholder="e.g., Container Manager v1.0">
</div>
<!-- Global Arguments Section -->
<div class="global-section">
<div class="section-title">Global Arguments</div>
<div class="argument-header">
<span>Parameters</span>
<span>Variable Name</span>
<span>Help Text</span>
<span></span>
</div>
<div id="global-arguments-container">
<!-- Global arguments rows -->
</div>
</div>
<!-- Subcommands Section (visible only in subcommand mode) -->
<div class="subcommands-container">
<div class="section-title">Subcommands</div>
<!-- Example Subcommand -->
<div class="subcommand-section">
<div class="subcommand-header">
<input type="text" class="subcommand-name-input" placeholder="container" value="container">
<input type="text" class="subcommand-desc-input" placeholder="Manage containers"
value="Manage containers">
<button class="toggle-collapse-btn"></button>
<button class="remove-btn">×</button>
</div>
<div class="subcommand-body">
<div class="argument-header">
<span>Parameters</span>
<span>Variable Name</span>
<span>Help Text</span>
<span></span>
</div>
<div class="arguments-container">
<!-- Subcommand arguments rows -->
<div class="argument-row">
<input type="text" placeholder="--name NAME" value="--name NAME">
<input type="text" placeholder="name" value="name">
<input type="text" placeholder="Container name" value="Container name">
<button class="remove-btn">×</button>
</div>
<div class="argument-row">
<input type="text" placeholder="-d --detach">
<input type="text" placeholder="detach">
<input type="text" placeholder="Run in background">
<button class="remove-btn">×</button>
</div>
<div class="argument-row">
<input type="text" placeholder="-v --verbose">
<input type="text" placeholder="">
<input type="text" placeholder="">
<button class="remove-btn">×</button>
</div>
</div>
</div>
</div>
<!-- Another Subcommand -->
<div class="subcommand-section collapsed">
<div class="subcommand-header">
<input type="text" class="subcommand-name-input" placeholder="image" value="image">
<input type="text" class="subcommand-desc-input" placeholder="Manage images"
value="Manage images">
<button class="toggle-collapse-btn"></button>
<button class="remove-btn">×</button>
</div>
<div class="subcommand-body">
<div class="argument-header">
<span>Parameters</span>
<span>Variable Name</span>
<span>Help Text</span>
<span></span>
</div>
<div class="arguments-container">
<div class="argument-row">
<input type="text" placeholder="-a --all" value="-a --all">
<input type="text" placeholder="all" value="all">
<input type="text" placeholder="Show all images" value="Show all images">
<button class="remove-btn">×</button>
</div>
<div class="argument-row">
<input type="text" placeholder="">
<input type="text" placeholder="">
<input type="text" placeholder="">
<button class="remove-btn">×</button>
</div>
</div>
</div>
</div>
<!-- Add Subcommand Button -->
<button class="add-subcommand-btn" id="add-subcommand-btn">
+ Add Subcommand
</button>
</div>
<button id="generate-btn" class="generate-btn">Generate BASH</button>
</section>
<!-- Output and Help sections remain the same -->
<section class="output-section" id="output-section" style="display: none;">
<h2>Generated Script</h2>
<div class="code-container">
<button class="copy-btn" id="copy-btn">Copy</button>
<pre><code id="generated-code"></code></pre>
</div>
</section>
<section class="help-section">
<h2>Help Output Preview</h2>
<div class="help-preview" id="help-preview">
<pre id="help-content">Add arguments to see the help output...</pre>
</div>
</section>
</div>
<script>
// Mode switching
document.querySelectorAll('.mode-btn').forEach(btn => {
btn.addEventListener('click', () => {
document.querySelectorAll('.mode-btn').forEach(b => b.classList.remove('active'));
btn.classList.add('active');
const mode = btn.dataset.mode;
const container = document.querySelector('.container');
container.className = 'container ' + mode + '-mode';
});
});
// Collapse toggle
document.addEventListener('click', (e) => {
if (e.target.classList.contains('toggle-collapse-btn')) {
e.target.closest('.subcommand-section').classList.toggle('collapsed');
}
});
// Add subcommand
document.getElementById('add-subcommand-btn').addEventListener('click', () => {
// Create new subcommand section
console.log('Add subcommand');
});
</script>
</body>
</html>

58
templates/index.html Normal file
View File

@@ -0,0 +1,58 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Bash Argument Parser Generator</title>
<link rel="stylesheet" href="/static/css/style.css">
</head>
<body>
<div class="container">
<header>
<h1>Bash Argument Parser Generator</h1>
</header>
<section class="input-section">
<div class="header-input">
<label for="custom-header">Custom Header / Greeting</label>
<input type="text" id="custom-header" placeholder="e.g., My Script v1.0 - Does amazing things">
</div>
<div class="arguments-section">
<h2>Arguments</h2>
<div class="argument-header">
<span class="col-params">Parameters</span>
<span class="col-command">Variable Name</span>
<span class="col-help">Help Text</span>
<span class="col-actions"></span>
</div>
<div id="arguments-container">
<!-- Arguments will be dynamically added here -->
</div>
</div>
<button id="generate-btn" class="generate-btn">Generate BASH</button>
</section>
<section class="output-section" id="output-section" style="display: none;">
<h2>Generated Script</h2>
<div class="code-container">
<button class="copy-btn" id="copy-btn">Copy</button>
<pre><code id="generated-code"></code></pre>
</div>
</section>
<section class="help-section">
<h2>Help Output Preview</h2>
<div class="help-preview" id="help-preview">
<pre id="help-content">Add arguments to see the help output...</pre>
</div>
</section>
</div>
<script src="/static/js/app.js"></script>
</body>
</html>