@astrojs/cli-kit
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -27,3 +27,3 @@ /** | ||
cursorOffset: number; | ||
clear: any; | ||
clear: string; | ||
placeholder: boolean | undefined; | ||
@@ -30,0 +30,0 @@ rendered: any; |
@@ -11,6 +11,3 @@ export declare const strip: (str: string) => string; | ||
export declare const split: (str: string) => Part[]; | ||
/** | ||
* @param {string} msg | ||
* @param {number} perLine | ||
*/ | ||
export declare function lines(msg: string, perLine: number): number; | ||
export default function (prompt: string, perLine: number): string; |
@@ -0,1 +1,2 @@ | ||
import { erase, cursor } from "sisteransi"; | ||
export const strip = (str) => { | ||
@@ -62,6 +63,2 @@ const pattern = [ | ||
}; | ||
/** | ||
* @param {string} msg | ||
* @param {number} perLine | ||
*/ | ||
export function lines(msg, perLine) { | ||
@@ -75,1 +72,12 @@ let lines = String(strip(msg) || '').split(/\r?\n/); | ||
; | ||
export default function (prompt, perLine) { | ||
if (!perLine) | ||
return erase.line + cursor.to(0); | ||
let rows = 0; | ||
const lines = prompt.split(/\r?\n/); | ||
for (let line of lines) { | ||
rows += 1 + Math.floor(Math.max(strip(line).length - 1, 0) / perLine); | ||
} | ||
return erase.lines(rows); | ||
} | ||
; |
{ | ||
"name": "@astrojs/cli-kit", | ||
"type": "module", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "types": "./dist/index.d.ts", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
50733
1572