182 lines
7.8 KiB
HTML
182 lines
7.8 KiB
HTML
<!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>
|