Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T8 #656

Merged
merged 45 commits into from
Aug 13, 2023
Merged

T8 #656

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
a35275b
#638
Jul 23, 2023
2b779c6
ojob: better shortcut display on cli
nmsaguiar Jul 26, 2023
b4578f4
withMD: side line + $pass + $sline + $set
nmsaguiar Jul 28, 2023
1375c63
+__flags.TEMPLATE_SET
nmsaguiar Jul 28, 2023
7e0f1b7
ow.format: withMD code blocks
Jul 29, 2023
1a23bd2
ow.format.withMD: check cblocks
Jul 29, 2023
9d7ebf0
ow.template: addOpenAFHelpers $concat
Jul 29, 2023
bdee855
ow.format.withMD: faint code blocks
Jul 29, 2023
c9080f1
bump commons-lang3
Jul 29, 2023
0875007
printTable: colors in __colorFormat
nmsaguiar Aug 1, 2023
03d95c6
bump handlebars 4.7.8
nmsaguiar Aug 2, 2023
556e56c
bump jsch
nmsaguiar Aug 2, 2023
2efc63c
Test results badge
github-actions[bot] Aug 2, 2023
b906970
Test results badge
github-actions[bot] Aug 2, 2023
3cc9921
Test results badge
github-actions[bot] Aug 2, 2023
246a721
ow.template: fix OpenAFHelpers
nmsaguiar Aug 2, 2023
1cc871f
testing __threadPoolFactor 2
nmsaguiar Aug 3, 2023
28c78ca
update pom
nmsaguiar Aug 3, 2023
2d5a206
+ow.format.string.wordWrapArray
nmsaguiar Aug 3, 2023
ce362e5
bump okio
nmsaguiar Aug 3, 2023
0fe1185
ow.template: new helpers $startsWith, $endsWith and $match
nmsaguiar Aug 3, 2023
d5fb457
Test results badge
github-actions[bot] Aug 3, 2023
70c0f31
Test results badge
github-actions[bot] Aug 3, 2023
1991263
Test results badge
github-actions[bot] Aug 3, 2023
e67883f
Test results badge
github-actions[bot] Aug 3, 2023
b95ea6c
Test results badge
github-actions[bot] Aug 3, 2023
b701112
Test results badge
github-actions[bot] Aug 3, 2023
37141dc
Merge branch 't8' into 20230803-193129
nmaguiar Aug 3, 2023
69d3e94
Merge pull request #649 from OpenAF/20230803-193129
nmaguiar Aug 3, 2023
461ca79
printTable word-wrap functionality
nmaguiar Aug 3, 2023
6fc13f8
small bug corrections
nmaguiar Aug 4, 2023
c9350e6
ow.oJob.output: +stable
nmaguiar Aug 4, 2023
bf975f8
ow.format.string.wordWrapArray: new calc
nmaguiar Aug 4, 2023
cbd1537
ow.format.withMD: +bullets, +num list and word wrap tables
Aug 5, 2023
699d970
ow.format.string.wordWrapArray correct column calc
nmaguiar Aug 5, 2023
5e5e0c7
bump jsch
Aug 5, 2023
7470b04
ow.format: withMD and wordWrap improvements
Aug 6, 2023
5dccc41
format.withSideLines: new themes closedOneSpace, simpleOneSpace, doub…
Aug 6, 2023
9d0806c
withMD: spaces on inline code
Aug 6, 2023
977c6d6
format: withSideLineTheme +blockCurvedSpace
Aug 6, 2023
a93f874
typo
Aug 6, 2023
9d138fa
format: withMD links
Aug 6, 2023
be04aad
ow.format.withMD: revert color scheme for code blocks
nmsaguiar Aug 7, 2023
1a923bd
#653
nmaguiar Aug 8, 2023
85e9209
Merge branch 'master' into t8
nmaguiar Aug 13, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions LICENSES.txt

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions js/handlebars.js

Large diffs are not rendered by default.

26 changes: 20 additions & 6 deletions js/ojob.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
var _fparam = __expr.split(/ +/).filter(r => !r.startsWith("-"))
var fparam = (isArray(_fparam) && _fparam.length > 0) ? _fparam[0] : "";
var fparam;
var params = processExpr(" ");
var ojob_shouldRun = true;
var ojob_args = {};
Expand Down Expand Up @@ -110,6 +109,8 @@ function ojob_showSyntax() {
}

function ojob__getFile() {
_fparam = __expr.split(/ +/).filter(r => !r.startsWith("-"))
fparam = (isArray(_fparam) && _fparam.length > 0) ? _fparam[0] : ""
if (isDef(fparam)) {
return fparam;
} else {
Expand Down Expand Up @@ -221,17 +222,24 @@ function ojob_draw() {
});

print(ansiColor("bold,underline", "\nPaths:"));
var _trans = job => {
job = ow.oJob.parseTodo(job)
if (isMap(job) && isDef(job.name))
return job.name
else
return job
}
oj.todo.forEach(function(v) {
if (isDef(v.job) && isUnDef(v.name)) v.name = v.job;
var nn = (isDef(v.name) ? v.name : v);
var paths = getPaths(nn);
var msg = "";
for (var i in paths.from) {
msg += (isDef(paths.from[i]) ? paths.from[i] + " -> " : "");
msg += (isDef(paths.from[i]) ? _trans(paths.from[i]) + " -> " : "");
}
msg += "[" + ansiColor("bold", nn) + "]";
for (var i in paths.to) {
msg += (isDef(paths.to[i]) ? " -> " + paths.to[i] : "");
msg += (isDef(paths.to[i]) ? " -> " + _trans(paths.to[i]) : "");
}
print(msg);
});
Expand Down Expand Up @@ -369,14 +377,20 @@ function ojob_todo() {
}

function ojob_shortcuts() {
var job = String(__expr).replace(/.*-shortcuts */i, "")
__expr = String(__expr).replace(job, "")
var file = ojob__getFile()

if (isDef(file) && file.trim() != "") {
var o = ow.loadOJob().parseTodo(ow.loadOJob().previewFile(file), true)
}

var tab = [], _lst = ow.loadOJob().parseTodo(__, true)
var _max = $from(_lst).attach("_len", r => r.job.length).max("_len")._len
var _maxJ = $from(_lst).attach("_len", r => $from(Object.keys(r.attrs).map(s=>s.length)).max()).max("_len")._len
_maxJ = Math.max(_maxJ, $from(_lst).attach("_len", r => r.name.length).max("_len")._len)
var _maxA = $from(_lst).attach("_len", r => $from(Object.values(r.attrs).map(s=>s.length)).max()).max("_len")._len

var job = String(__expr).replace(/.*-shortcuts */i, "")

$from(_lst)
.sort("job")
.select(r => {
Expand Down
40 changes: 27 additions & 13 deletions js/openaf.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ var __flags = ( typeof __flags != "undefined" && "[object Object]" == Object.pro
OJOB_CHECK_JOB_CHANGES : false,
OAF_CLOSED : false,
OAF_PRECOMPILE_LEVEL : 2,
TEMPLATE_SET : true,
VISIBLELENGTH : true,
MD_NOMAXWIDTH : true,
MD_SHOWDOWN_OPTIONS : {},
Expand All @@ -191,6 +192,11 @@ var __flags = ( typeof __flags != "undefined" && "[object Object]" == Object.pro
wordWrap : true,
compact : true
},
TABLE: {
wordWrap : true,
wordWrapUseSep : false,
wordWrapLimitFactor: 2
},
CONSOLE: {
view: "tree"
},
Expand Down Expand Up @@ -745,22 +751,26 @@ const printBars = function(as, hSize, aMax, aMin, aIndicatorChar, aSpaceChar) {

/**
* <odoc>
* <key>printTable(anArrayOfEntries, aWidthLimit, displayCount, useAnsi, aTheme, aBgColor) : String</key>
* <key>printTable(anArrayOfEntries, aWidthLimit, displayCount, useAnsi, aTheme, aBgColor, wordWrap, useRowSep) : String</key>
* Returns a ASCII table representation of anArrayOfEntries where each entry is a Map with the same keys.
* Optionally you can specify aWidthLimit, useAnsi and/or aBgColor.
* If you want to include a count of rows just use displayCount = true. If useAnsi = true you can provide a theme (e.g. "utf" or "plain")
* </odoc>
*/
const printTable = function(anArrayOfEntries, aWidthLimit, displayCount, useAnsi, aTheme, aBgColor) {
var count = 0;
const printTable = function(anArrayOfEntries, aWidthLimit, displayCount, useAnsi, aTheme, aBgColor, wordWrap, useRowSep) {
var count = 0, inCount = anArrayOfEntries.length
var maxsize = {};
var output = "";
aBgColor = _$(aBgColor, "aBgColor").isString().default(__)
var colorMap = { lines: "RESET", value: "CYAN" };
aBgColor = _$(aBgColor, "aBgColor").isString().default(__)
wordWrap = _$(wordWrap, "wordWrap").isBoolean().default(__flags.TABLE.wordWrap)
useRowSep = _$(useRowSep, "useRowSep").isBoolean().default(__flags.TABLE.wordWrapUseSep)

var colorMap = __colorFormat.table

if (isDef(aBgColor)) {
colorMap.lines = aBgColor + "," + colorMap.lines
colorMap.value = aBgColor + "," + colorMap.value
colorMap.title = aBgColor + "," + colorMap.title
}

ow.loadFormat();
Expand Down Expand Up @@ -799,7 +809,10 @@ const printTable = function(anArrayOfEntries, aWidthLimit, displayCount, useAnsi

if (!Array.isArray(anArrayOfEntries)) return "";
if (isUnDef(aWidthLimit)) aWidthLimit = -1;


// If wordwrap generate new array
anArrayOfEntries = (aWidthLimit <= 0 ? anArrayOfEntries : ow.format.string.wordWrapArray(anArrayOfEntries, aWidthLimit, ansiLength(vLine), useRowSep ? s => ansiColor("FAINT", repeat(s, "-")) : __))

// Find sizes
anArrayOfEntries.forEach(function(row) {
var cols = Object.keys(row);
Expand All @@ -817,17 +830,17 @@ const printTable = function(anArrayOfEntries, aWidthLimit, displayCount, useAnsi
var cols = Object.keys(row);
if (count == 0) {
//output += (useAnsi ? ansiColor("bold", "|") : "|");
output += (useAnsi ? ansiColor(colorMap.lines, "") : "");
output += (useAnsi ? ansiColor(colorMap.title, "") : "");
lineSize = 1; outOfWidth = false; colNum = 0;
cols.forEach(function(col) {
if (outOfWidth) return;
lineSize += maxsize[String(col)] + 1;
if (aWidthLimit > 0 && lineSize > (aWidthLimit+3)) {
output += (useAnsi ? ansiColor(colorMap.lines, "...") : "..."); outOfWidth = true;
output += (useAnsi ? ansiColor(colorMap.title, "...") : "..."); outOfWidth = true;
} else {
var _ps = repeat(Math.floor((maxsize[String(col)] - ansiLength(String(col)))/2), ' ')
var _pe = repeat(Math.round((maxsize[String(col)] - ansiLength(String(col))) / 2), ' ')
output += (useAnsi ? ansiColor(colorMap.lines, _ps + String(col) + _pe) : _ps + String(col) + _pe)
output += (useAnsi ? ansiColor(colorMap.title, _ps + String(col) + _pe) : _ps + String(col) + _pe)
if (colNum < (cols.length-1)) output += (useAnsi ? ansiColor(colorMap.lines, vLine) : vLine);
}
colNum++;
Expand Down Expand Up @@ -869,7 +882,7 @@ const printTable = function(anArrayOfEntries, aWidthLimit, displayCount, useAnsi
});

if (displayCount) {
var summary = "[#" + count + " " + ((count <= 1) ? "row" : "rows") + "]";
var summary = "[#" + inCount + " " + ((inCount <= 1) ? "row" : "rows") + "]";
output += (useAnsi ? ansiColor(colorMap.lines, summary) : summary);
}

Expand Down Expand Up @@ -1675,7 +1688,8 @@ var __colorFormat = {
default: "YELLOW",
askPre: "YELLOW,BOLD",
askQuestion: "BOLD",
askPos: "BLUE"
askPos: "BLUE",
table: { lines: "RESET", value: "RESET", title: "BOLD" }
};
const colorify = function(json) {
if (typeof json != 'string') {
Expand Down Expand Up @@ -7636,7 +7650,7 @@ AF.prototype.toSLON = function(aObject, aTheme) {
* </odoc>
*/
AF.prototype.toCSLON = function(aObject, aTheme) {
ow.loadFormat
ow.loadFormat()
return ow.format.toCSLON(aObject, aTheme)
}

Expand Down Expand Up @@ -8752,7 +8766,7 @@ const $channels = function(a) {
const $ch = $channels;

var __threadPool;
var __threadPoolFactor = 1;
var __threadPoolFactor = 2

const __resetThreadPool = function(poolFactor) {
__threadPoolFactor = poolFactor;
Expand Down
Loading
Loading