|
1 | 1 | import type { AudioxOptions } from '../src/types' |
2 | 2 | import process from 'node:process' |
3 | 3 | import { CLI } from '@stacksjs/clapp' |
| 4 | +import { Logger } from '@stacksjs/clarity' |
4 | 5 | import { version } from '../package.json' |
5 | 6 | import { audio } from '../src/audio' |
6 | 7 | import { audioInfo } from '../src/audio-info' |
7 | 8 | import { debugLog } from '../src/utils' |
8 | 9 |
|
| 10 | +const logger = new Logger('audiox', { |
| 11 | + showTags: false, |
| 12 | +}) |
| 13 | + |
9 | 14 | const cli = new CLI('audiox') |
10 | 15 |
|
11 | 16 | cli |
|
68 | 73 | debugLog('cli', 'Conversion complete', options.verbose) |
69 | 74 | } |
70 | 75 | catch (error: any) { |
71 | | - console.error('Error:', error.message) |
| 76 | + logger.error('Error:', error.message) |
72 | 77 | process.exit(1) |
73 | 78 | } |
74 | 79 | }) |
|
89 | 94 | const info = await audioInfo(input, infoOptions) |
90 | 95 |
|
91 | 96 | // Pretty print the audio information |
92 | | - console.log('\nAudio Information:') |
93 | | - console.log('----------------') |
| 97 | + logger.info('\nAudio Information:') |
| 98 | + logger.info('----------------') |
94 | 99 | for (const stream of info) { |
95 | | - console.log(`Codec: ${stream.codec}`) |
96 | | - console.log(`Channels: ${stream.channels}`) |
97 | | - console.log(`Sample Rate: ${stream.sampleRate} Hz`) |
98 | | - console.log(`Bitrate: ${Math.round(Number.parseInt(stream.bitrate) / 1000)}k`) |
99 | | - console.log(`Duration: ${Math.round(Number.parseFloat(stream.duration) * 100) / 100}s`) |
| 100 | + logger.info(`Codec: ${stream.codec}`) |
| 101 | + logger.info(`Channels: ${stream.channels}`) |
| 102 | + logger.info(`Sample Rate: ${stream.sampleRate} Hz`) |
| 103 | + logger.info(`Bitrate: ${Math.round(Number.parseInt(stream.bitrate) / 1000)}k`) |
| 104 | + logger.info(`Duration: ${Math.round(Number.parseFloat(stream.duration) * 100) / 100}s`) |
100 | 105 |
|
101 | 106 | if (stream.metadata && Object.keys(stream.metadata).length > 0) { |
102 | | - console.log('\nMetadata:') |
| 107 | + logger.info('\nMetadata:') |
103 | 108 | for (const [key, value] of Object.entries(stream.metadata)) { |
104 | | - console.log(`${key}: ${value}`) |
| 109 | + logger.info(`${key}: ${value}`) |
105 | 110 | } |
106 | 111 | } |
107 | | - console.log('----------------') |
| 112 | + logger.info('----------------') |
108 | 113 | } |
109 | 114 | } |
110 | 115 | catch (error: any) { |
111 | | - console.error('Error:', error.message) |
| 116 | + logger.error('Error:', error.message) |
112 | 117 | process.exit(1) |
113 | 118 | } |
114 | 119 | }) |
|
117 | 122 | .command('completion', 'Generate shell completion script') |
118 | 123 | .action(async () => { |
119 | 124 | // TODO: Implement shell completion generation |
120 | | - console.log('Shell completion not implemented yet') |
| 125 | + logger.info('Shell completion not implemented yet') |
121 | 126 | }) |
122 | 127 |
|
123 | 128 | cli.command('version', 'Show the version of the Reverse Proxy CLI').action(async () => { |
|
0 commit comments