Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianschubek committed Mar 12, 2023
1 parent 4e290a0 commit 92bf718
Show file tree
Hide file tree
Showing 9 changed files with 511 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/node_modules
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"printWidth": 150
}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Adrian
Copyright (c) 2023 Adrian Schubek

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,23 @@
# upp
Universal Pre-Processor
Universal File Pre-Processor


any file with

./tool test.txt --VAR=bla > out.txt

ifeq
ifne (!=)
iflt (<)
ifgt
ifge
ifle (<=)

--- test.txt
!!ifeq VAR bla!!
lol
!!endif!!

--- alternative same zeile

test !#ifeq
68 changes: 68 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const yargs_1 = __importDefault(require("yargs/yargs"));
const helpers_1 = require("yargs/helpers");
const chalk_1 = __importDefault(require("chalk"));
const fs = __importStar(require("fs"));
const log = console.log;
(0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
.scriptName("upp")
.usage("Universal Pre-Processor ('upp') is a tool for preprocessing files.")
.epilogue("for more info and support visit https://github.com/adrianschubek/upp")
.version("0.1.0")
// .command("check <file>", "checks the preprocessor", (builder) => {})
.command(["run <file>", "$0"], "runs the preprocessor", (builder) => {
builder
.positional("file", {
alias: "f",
describe: "the file to preprocess",
type: "string",
demandOption: true,
})
.option("output", {
alias: "o",
describe: "the output file",
default: "stdout",
type: "string",
});
}, (argv) => {
log(argv);
if (!fs.existsSync(argv.file))
log(chalk_1.default.red("File does not exist!"));
if (argv.output === "stdout") {
log(chalk_1.default.yellow("Outputting to stdout..."));
}
})
.option("verbose", {
describe: "verbose output",
type: "boolean",
default: false,
})
.demandCommand(1)
.parse();
237 changes: 237 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "upp",
"version": "0.1.0",
"description": "Universal Pre-Processor",
"main": "dist/index.js",
"scripts": {},
"repository": {
"type": "git",
"url": "git+https://github.com/adrianschubek/upp.git"
},
"author": "Adrian Schubek",
"license": "MIT",
"bugs": {
"url": "https://github.com/adrianschubek/upp/issues"
},
"homepage": "https://github.com/adrianschubek/upp#readme",
"dependencies": {
"chalk": "^4.1.2",
"yargs": "^17.7.1"
},
"devDependencies": {
"@types/node": "^18.15.0",
"@types/yargs": "^17.0.22"
}
}
Loading

0 comments on commit 92bf718

Please sign in to comment.