Skip to content

Commit

Permalink
fix(cli): not supported yet
Browse files Browse the repository at this point in the history
  • Loading branch information
snomiao committed Jan 21, 2023
1 parent d808ca2 commit 86a9a97
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
28 changes: 17 additions & 11 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,26 @@ async function main() {
);
process.chdir(pkgdir);
await aswitcher(process.platform, {
aix: async () => console.log("auto install not supported"),
android: async () => console.log("auto install not supported"),
cygwin: async () => console.log("auto install not supported"),
aix: async () => notSupportedYet(),
android: async () => notSupportedYet(),
cygwin: async () => notSupportedYet(),
darwin: async () => {
console.log({ pkgdir, cwd: process.cwd() });
await snorun("cp -r Rime/* ~/Library/Rime");
console.log("go to your task bar, find <deploy> button and click.");
(await snorun("cp -r Rime/* ~/Library/Rime"))
? console.log("go to your task bar, find <deploy> button and click.")
: await notSupportedYet();
},
freebsd: async () => console.log("auto install not supported"),
haiku: async () => console.log("auto install not supported"),
linux: async () => console.log("auto install not supported"),
netbsd: async () => console.log("auto install not supported"),
openbsd: async () => console.log("auto install not supported"),
sunos: async () => console.log("auto install not supported"),
freebsd: async () => notSupportedYet(),
haiku: async () => notSupportedYet(),
linux: async () => notSupportedYet(),
netbsd: async () => notSupportedYet(),
openbsd: async () => notSupportedYet(),
sunos: async () => notSupportedYet(),
win32: async () => await snorun("cd tools && install"),
});
async function notSupportedYet() {
console.log("[rime-snomiao] auto install not supported yet");
console.log(`[rime-snomiao] plz copy from this folder ${`${pkgdir}/Rime`}`);
console.log(`[rime-snomiao] to your Rime user configuration directory`);
}
}
11 changes: 5 additions & 6 deletions src/zhen-cc-ce/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,33 @@ import esMain from "es-main";
import { writeFile } from "fs/promises";
import { globby } from "globby";
import { flatMap } from "lodash-es";
import { format } from "prettier";
import { filter, map, pipe, sortBy, uniq } from "rambda";
import snohmr from "snohmr";
import workPackageDir from "work-package-dir";
import MDictTypescript from "../lib/mdictTypescript";
import { format } from "prettier";
import mdxEntriesParse from "../lib/mdxFileParse";
if (esMain(import.meta)) await index();

export default async function index() {
await workPackageDir();
const [file, ...rest] = await globby("dict/CC-CEDICT*/*.mdx");
if (rest.length) throw new Error("too many dict files");
const pairs = mdxEntriesParse(file);
const entries = await mdxEntriesParse(file);

for await (const { parse } of snohmr(() => import("./index"))) {
await parse(pairs)
await parse(entries)
.then(() => {
// maybe deploy
})
.catch(console.error);
}
}

export async function parse(pairs: (readonly [string, string])[]) {
export async function parse(entries: (readonly [string, string])[]) {
console.log(chalk.bgWhite("====================================="));
let k = 10;
const zhjpWordCC = pipe(
() => pairs,
() => entries,
sortBy(Math.random),
// (e) => e.slice(0, 100),
filter(([k, v]) => Boolean(v)),
Expand Down

0 comments on commit 86a9a97

Please sign in to comment.