Skip to content

copy/pasting a list of commands from maestro studio now has the correct formatting when pasting into a yaml file #2405

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 26 additions & 3 deletions maestro-studio/web/src/components/commands/ReplView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,32 @@ import { useDeviceContext } from "../../context/DeviceContext";
import { useRepl } from '../../context/ReplContext';

const getFlowText = (selected: ReplCommand[]): string => {
return selected
.map((c) => (c.yaml.endsWith("\n") ? c.yaml : `${c.yaml}\n`))
.join("");
let combinedYaml = '';

// Process each command independently
selected.forEach(command => {
// Get the first line of the command YAML
const lines = command.yaml.split('\n');
if (lines.length === 0) return;

// Process the first line (command line)
let firstLine = lines[0].trim();
if (!firstLine.startsWith('-')) {
firstLine = `- ${firstLine}`;
}
combinedYaml += firstLine + '\n';

// Process the parameter lines
for (let i = 1; i < lines.length; i++) {
const line = lines[i].trim();
if (line) {
// Parameters should have 4-space indentation
combinedYaml += ' ' + line + '\n';
}
}
});

return combinedYaml;
};

const ReplView = () => {
Expand Down
Loading