Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

22
LINES

< > BotCompany Repo | #1021493 // dm_gazelle_addRuleWithComment - with info box

JavaX fragment (include)

scope dm_gazelle_addRuleWithComment.

static new ThreadLocal<S> #msg;
static new ThreadLocal<Bool> #renderWithoutComments;
static new ThreadLocal<Bool> #noInfoBox;

// returns (ruleID, isNew)
static Pair<S, Bool> dm_gazelle_addRuleWithComment(S text, S comment) {
  Pair<S, Bool> p = cast quickImport(dm_call(dm_gazelle_rulesModule(), 'addRuleWithComment, text, comment));
  S rendered = newLinesToSpaces_trim(text);
  if (nempty(comment) && !isTrue(renderWithoutComments))
    rendered += " [comments: " + joinLinesWithComma(comment) + "]";
  S _msg = setTLAndReturn(msg, p.b ? "Rule " + p.a + " added: " + rendered : "Rule already there: " + p.a + " - " + rendered);
  if (!boolPar(noInfoBox)) infoBox(_msg);
  ret p;
}

static Pair<S, Bool> dm_gazelle_addRuleWithComment(S when, S then, S comment) {
  ret dm_gazelle_addRuleWithComment(when + "\n=> " + then, comment);
}

end scope

Author comment

Began life as a copy of #1021459

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, whxojlpjdney

No comments. add comment

Snippet ID: #1021493
Snippet name: dm_gazelle_addRuleWithComment - with info box
Eternal ID of this version: #1021493/12
Text MD5: 63047cca2d28dc29c0d53bccf3eb725c
Author: stefan
Category: javax / stefan's os / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-04-07 15:38:52
Source code size: 905 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 280 / 345
Version history: 11 change(s)
Referenced in: [show references]