editprompt 0.4.3 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +7 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ import { promisify } from "node:util";
8
8
  import clipboardy from "clipboardy";
9
9
 
10
10
  //#region package.json
11
- var version = "0.4.3";
11
+ var version = "0.4.4";
12
12
 
13
13
  //#endregion
14
14
  //#region src/config/constants.ts
@@ -84,8 +84,10 @@ async function launchEditor(editor, filePath, envVars) {
84
84
  }
85
85
  async function readFileContent(filePath) {
86
86
  try {
87
- const content = await readFile(filePath, "utf-8");
88
- return content.trim();
87
+ let content = await readFile(filePath, "utf-8");
88
+ content = content.replace(/\n$/, "");
89
+ if (/@[^\n]*$/.test(content)) content += " ";
90
+ return content;
89
91
  } catch (error) {
90
92
  throw new Error(`Failed to read file: ${error instanceof Error ? error.message : "Unknown error"}`);
91
93
  }
@@ -112,12 +114,12 @@ function isMuxType(value) {
112
114
  }
113
115
  async function sendToTmuxPane(paneId, content) {
114
116
  await execAsync(`tmux if-shell -t '${paneId}' '[ "#{pane_in_mode}" = "1" ]' "copy-mode -q -t '${paneId}'"`);
115
- await execAsync(`tmux send-keys -t '${paneId}' '${content.replace(/'/g, "'\\''")}'`);
117
+ await execAsync(`tmux send-keys -t '${paneId}' -- '${content.replace(/'/g, "'\\''")}'`);
116
118
  console.log(`Content sent to tmux pane: ${paneId}`);
117
119
  await execAsync(`tmux select-pane -t '${paneId}'`);
118
120
  }
119
121
  async function sendToWeztermPane(paneId, content) {
120
- await execAsync(`wezterm cli send-text --no-paste --pane-id '${paneId}' '${content.replace(/'/g, "'\\''")}'`);
122
+ await execAsync(`wezterm cli send-text --no-paste --pane-id '${paneId}' -- '${content.replace(/'/g, "'\\''")}'`);
121
123
  console.log(`Content sent to wezterm pane: ${paneId}`);
122
124
  }
123
125
  async function copyToClipboard(content) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "editprompt",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
4
4
  "author": "eetann",
5
5
  "description": "A CLI tool that lets you write prompts for CLI tools using your favorite text editor",
6
6
  "license": "MIT",