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

22
LINES

< > BotCompany Repo | #1015515 // React to last line typed in terminal

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Libraryless. Click here for Pure Java version (10263L/73K).

1  
!7
2  
3  
static JLabel lblTime;
4  
5  
p-tt {
6  
  putBesideMemoryView(lblTime = jlabel());
7  
    
8  
  while licensed {
9  
    long time = sysNow();
10  
    S contents = ocr_terminalContents();
11  
    setText(lblTime, " " + elapsedMS(time) + " ms | ");
12  
    if (empty(contents)) continue;
13  
    S line = lastLine(rtrim(contents));
14  
    line = dropSuffix(diamond(), line);
15  
    print("Line: " + line);
16  
    int i = indexOf(line, " $ ");
17  
    if (i < 0) continue;
18  
    S cmd = trimSubstring(line, i+3);
19  
    if (eqic(cmd, "list"))
20  
      infoBox("You mean: ls");
21  
  }
22  
}

Author comment

Began life as a copy of #1015514

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1015515
Snippet name: React to last line typed in terminal
Eternal ID of this version: #1015515/6
Text MD5: db73992fc8341c605eacb72b7d72b896
Transpilation MD5: b81c15fbfb561f2cf48475f479ce9904
Author: stefan
Category: javax / imaging
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-05-15 12:14:19
Source code size: 549 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 440 / 1078
Version history: 5 change(s)
Referenced in: [show references]