Skip to content

Commit

Permalink
add new command: list
Browse files Browse the repository at this point in the history
Signed-off-by: Kirill Mokevnin <mokevnin@gmail.com>
  • Loading branch information
mokevnin committed Mar 5, 2025
1 parent b41a3a9 commit c132ff3
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ jobs-download:
jobs-normalize:
DEBUG=app* npx tsx bin/dev.ts normalize

jobs-list:
DEBUG=app* npx tsx bin/dev.ts list python

jobs-analyze:
DEBUG=app* npx tsx bin/dev.ts analyze python

Expand Down
1 change: 1 addition & 0 deletions src/analysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const getSkillFrequencies = async (searchQuery: SearchQuery) => {
async function analyze(term: string, log: LoggerFn) {
const searchQuery = await db.query.sq.findFirst({ where: eq(schema.sq.term, term) })
if (!searchQuery) {
log(`"${term}" does not downloaded. Check list`)
return {}
}

Expand Down
11 changes: 11 additions & 0 deletions src/commands/list.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import debug from 'debug'
import { Command } from '@oclif/core'
import list from '../list.js'

const debugLog = debug('app:cli')

export default class List extends Command {
public async run(): Promise<void> {
await list(this.log.bind(this))
}
}
9 changes: 9 additions & 0 deletions src/list.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { LoggerFn } from '../types'
import db from './lib/db.js'

async function list(log: LoggerFn) {
const searchQueres = await db.query.sq.findMany()
console.table(searchQueres)
}

export default list

0 comments on commit c132ff3

Please sign in to comment.