File size: 672 Bytes
5f40163 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | import { create } from "zustand";
export type Command = {
content: string;
type: "input" | "output";
};
interface CommandState {
commands: Command[];
appendInput: (content: string) => void;
appendOutput: (content: string) => void;
clearTerminal: () => void;
}
export const useCommandStore = create<CommandState>((set) => ({
commands: [],
appendInput: (content: string) =>
set((state) => ({
commands: [...state.commands, { content, type: "input" }],
})),
appendOutput: (content: string) =>
set((state) => ({
commands: [...state.commands, { content, type: "output" }],
})),
clearTerminal: () => set({ commands: [] }),
}));
|