-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
now you can create config file to manage the package
- Loading branch information
1 parent
fb7dc40
commit 6653a21
Showing
6 changed files
with
837 additions
and
292 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,35 @@ | ||
#!/usr/bin/env node | ||
#!/usr/bin/env bash | ||
":"; //# comment; exec /usr/bin/env node --input-type=module - "$@" < "$0" | ||
|
||
const yargs = require("yargs/yargs"); | ||
const { hideBin } = require("yargs/helpers"); | ||
import yargs from "yargs"; | ||
import { hideBin } from "yargs/helpers"; | ||
|
||
const singleUser = require('./cli/singleUser/index') | ||
import singleUser from "./cli/singleUser/index.js"; | ||
|
||
import acessConfigFile from "./config/acessConfigFile.js"; | ||
|
||
import taskListLog from "./services/tasklistLog.js"; | ||
|
||
const argv = yargs(hideBin(process.argv)).argv; | ||
|
||
if (argv.userMail) { | ||
singleUser(); | ||
return; | ||
try { | ||
|
||
if (argv.userMail) { | ||
singleUser(); | ||
} else { | ||
const configData = await acessConfigFile(); | ||
|
||
if (configData) { | ||
if (configData.userEmail) { | ||
taskListLog({ userEmail: configData.userEmail }); | ||
} | ||
} | ||
} | ||
|
||
|
||
} catch (error) { | ||
|
||
console.log('error Occured', error); | ||
|
||
} | ||
|
||
console.error("--usermail param is required"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import path from "node:path"; | ||
import { findUp, pathExists } from "find-up"; | ||
import fs from "fs"; | ||
|
||
const acessConfigFile = async () => { | ||
try { | ||
const filedir = await findUp("weeklycommit.config.json"); | ||
|
||
if (!filedir) { | ||
console.log("This is no data found"); | ||
return; | ||
} | ||
|
||
const data = JSON.parse(fs.readFileSync(filedir, "utf8")); | ||
|
||
return data; | ||
|
||
} catch (error) { | ||
throw error; | ||
} | ||
}; | ||
|
||
export default acessConfigFile; |
Oops, something went wrong.