-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added gen command to create cpp template for CP and added metadata.js…
…on. Created two utilities for printing Errors and Success
- Loading branch information
1 parent
f83a06e
commit 5436ce5
Showing
9 changed files
with
70 additions
and
16 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 |
---|---|---|
|
@@ -2,6 +2,9 @@ | |
tests | ||
*.exe | ||
build | ||
rust | ||
go | ||
cpp | ||
native-cpp | ||
.gitignore | ||
deno/binaries | ||
|
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,21 +1,25 @@ | ||
import { bold, blue,green, red, yellow, italic} from "https://deno.land/[email protected]/fmt/colors.ts"; | ||
import {checkFolder, showVersion} from "./src/index.ts"; | ||
import {checkFolder, generateTemplate, showVersion} from "./src/index.ts"; | ||
|
||
const printFileError = (): void => { | ||
console.log(red(bold("Error At Loading File. Please Make Sure You provided correct Name"))); | ||
} | ||
|
||
|
||
if(Deno.args[0] == undefined) { | ||
printFileError(); | ||
console.log(bold(blue("Welcome To CMON :) !@^%&*(@!"))); | ||
Deno.exit(0); | ||
} | ||
if(Deno.args[0] == 'version') { | ||
else if(Deno.args[0] == 'version') { | ||
console.log(bold(yellow('Version'))); | ||
console.log(showVersion()); | ||
Deno.exit(0); | ||
} | ||
|
||
else if(Deno.args[0] == 'gen' && Deno.args[1]){ | ||
generateTemplate(Deno.args[1]); | ||
Deno.exit(0); | ||
} | ||
const PATH = Deno.args[0]; | ||
|
||
const fileNameArr = Deno.args[0].split('/'); | ||
|
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,5 @@ | ||
{ | ||
"author": "Deepak Aravind", | ||
"github": "https://github.com/codesculpture/cmon", | ||
"version": "1.0.2-alpha" | ||
} |
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,35 @@ | ||
import {printError, printSuccess} from "../index.ts"; | ||
const content = `#include<bits/stdc++.h> | ||
#define ll long long | ||
#define vi vector<int> | ||
#define vp vector<pair<int, int>> | ||
#define pb push_back | ||
#define pi pair<int, int> | ||
using namespace std; | ||
void solve() { | ||
//Crack It.. | ||
} | ||
int main() { | ||
int T; | ||
cin >> T; | ||
while(T--) solve(); | ||
return 0; | ||
} | ||
` | ||
|
||
|
||
const generateTemplate = (name: string): void => { | ||
|
||
try{ | ||
Deno.writeTextFile(name+".cpp", content); | ||
printSuccess(`Created Template ${name}.cpp Open in your Code Editor`); | ||
} | ||
catch(e){ | ||
printError({name: 'At Creating Template', code: e.message}) | ||
} | ||
} | ||
|
||
export default generateTemplate; |
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,5 +1,7 @@ | ||
import checkFolder from './checkFolder/checkFolder.ts'; | ||
import showVersion from './version/version.ts' | ||
import printError from './print/printError.ts'; | ||
import printSuccess from './print/printSuccess.ts'; | ||
import generateTemplate from './genCP/createTemplate.ts'; | ||
|
||
|
||
export {checkFolder, showVersion}; | ||
export {checkFolder, showVersion, generateTemplate, printError, printSuccess}; |
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,7 @@ | ||
import { bold, blue,green, red, yellow, italic} from "https://deno.land/[email protected]/fmt/colors.ts"; | ||
|
||
const printError = ({name, code}: {name: string, code:string}): void => { | ||
console.log(bold(red(`Error At ${name} Code:${code}`))); | ||
} | ||
|
||
export default printError; |
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,7 @@ | ||
import { bold, blue,green, red, yellow, italic} from "https://deno.land/[email protected]/fmt/colors.ts"; | ||
|
||
const printSuccess = (message: string): void =>{ | ||
console.log(green(`Successfully ${message}!`)); | ||
} | ||
|
||
export default printSuccess; |
This file was deleted.
Oops, something went wrong.
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,7 +1,6 @@ | ||
import "https://deno.land/x/dotenv/load.ts"; | ||
|
||
import meta from '../../metadata.json' assert {type: "json"}; | ||
const showVersion = (): string | undefined => { | ||
return Deno.env.get('VERSION'); | ||
return meta.version; | ||
} | ||
|
||
export default showVersion; |