easy-cli-framework
Version:
A framework for building CLI applications that are robust and easy to maintain. Supports theming, configuration files, interactive prompts, and more.
34 lines (28 loc) • 659 B
text/typescript
import { CsvFile } from 'easy-cli-framework';
const main = async () => {
// Load CSV File
const file = new CsvFile('./username.csv');
// Get the data from the CSV File
const data = await file.read();
console.log(data);
// Append a new line to the CSV File
await file.write([
{
Username: 'alice_bob',
'First name': 'Alice',
'Last name': 'Bob',
Identifer: data.length + 1,
},
]);
await file.append([
{
Username: 'bob_alice',
'First name': 'Bob',
'Last name': 'Alice',
Identifer: data.length + 2,
},
]);
};
main()
.catch(console.error)
.finally(() => process.exit(0));