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)

1  
scope dm_gazelle_addRuleWithComment.
2  
3  
static new ThreadLocal<S> #msg;
4  
static new ThreadLocal<Bool> #renderWithoutComments;
5  
static new ThreadLocal<Bool> #noInfoBox;
6  
7  
// returns (ruleID, isNew)
8  
static Pair<S, Bool> dm_gazelle_addRuleWithComment(S text, S comment) {
9  
  Pair<S, Bool> p = cast quickImport(dm_call(dm_gazelle_rulesModule(), 'addRuleWithComment, text, comment));
10  
  S rendered = newLinesToSpaces_trim(text);
11  
  if (nempty(comment) && !isTrue(renderWithoutComments))
12  
    rendered += " [comments: " + joinLinesWithComma(comment) + "]";
13  
  S _msg = setTLAndReturn(msg, p.b ? "Rule " + p.a + " added: " + rendered : "Rule already there: " + p.a + " - " + rendered);
14  
  if (!boolPar(noInfoBox)) infoBox(_msg);
15  
  ret p;
16  
}
17  
18  
static Pair<S, Bool> dm_gazelle_addRuleWithComment(S when, S then, S comment) {
19  
  ret dm_gazelle_addRuleWithComment(when + "\n=> " + then, comment);
20  
}
21  
22  
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: 358 / 420
Version history: 11 change(s)
Referenced in: [show references]