codepet 1.0.20 → 1.0.22
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.
- package/bin/codepet.js +4 -4
- package/package.json +1 -1
- package/scripts/img2ascii.py +6 -0
package/bin/codepet.js
CHANGED
|
@@ -318,8 +318,8 @@ function renderSprite(character, variant) {
|
|
|
318
318
|
}
|
|
319
319
|
if (fs.existsSync(spritePath) && fs.existsSync(renderScript)) {
|
|
320
320
|
try {
|
|
321
|
-
|
|
322
|
-
|
|
321
|
+
// stdio: 'inherit' 让 Python 直接写入终端(保留 ANSI 彩色)
|
|
322
|
+
execSync(`${PYTHON} "${renderScript}" "${spritePath}" ${RENDER_WIDTH}`, { stdio: 'inherit' });
|
|
323
323
|
} catch (e) {}
|
|
324
324
|
}
|
|
325
325
|
}
|
|
@@ -488,7 +488,7 @@ function doPopup() {
|
|
|
488
488
|
// Windows: 弹新 PowerShell 窗口,自动开启 ANSI 彩色支持
|
|
489
489
|
const script = path.join(__dirname, '..', 'scripts', 'polaroid.py').replace(/\\/g, '/');
|
|
490
490
|
// Windows: cmd /c "start cmd /k ..." 是最可靠的弹窗方式
|
|
491
|
-
execSync(`cmd /c "start cmd /k ${PYTHON}
|
|
491
|
+
execSync(`cmd /c "start cmd /k ${PYTHON} ${script} ${pet.character} ${scene} 40"`, { shell: true, stdio: 'ignore' });
|
|
492
492
|
} else {
|
|
493
493
|
// Linux: 尝试终端弹窗
|
|
494
494
|
const script = path.join(__dirname, '..', 'scripts', 'polaroid.py');
|
|
@@ -511,7 +511,7 @@ function doCard() {
|
|
|
511
511
|
const cardScript = path.join(__dirname, '..', 'scripts', 'pet_card.py');
|
|
512
512
|
if (fs.existsSync(cardScript)) {
|
|
513
513
|
try {
|
|
514
|
-
execSync(`${PYTHON} "${cardScript}"`, {
|
|
514
|
+
execSync(`${PYTHON} "${cardScript}"`, { stdio: 'inherit' });
|
|
515
515
|
// 跨平台打开图片
|
|
516
516
|
const cardPath = path.join(os.homedir(), '.codepet', 'card.png');
|
|
517
517
|
const openCmd = process.platform === 'win32' ? 'start ""' : process.platform === 'darwin' ? 'open' : 'xdg-open';
|
package/package.json
CHANGED
package/scripts/img2ascii.py
CHANGED