Skip to content

Commit 07bfe3e

Browse files
committed
Db to markdown migration
1 parent 513c364 commit 07bfe3e

4,323 files changed

Lines changed: 283871 additions & 62 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ local.properties
1313
*.aab
1414
*.jar
1515
/html
16-
/assets/tldr
1716
.claude
18-
/data/intructions.md
19-
/data/processed.txt
17+
processed.txt
18+
instructions-tldr.md
19+
instructions-man.md
20+
commands.txt

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22

33
![Icon](https://raw.githubusercontent.com/SimonSchubert/LinuxCommandLibrary/master/art/web_hi_res_144.png)
44

5-
The app currently has **7896** manual pages, **22+** basic categories and a bunch of general terminal tips. It works 100% offline, doesn't need an internet connection and has no tracking software.
5+
BREAKING CHANGE:
6+
All commands, tips and basics are now defined as markdown files in /assets and the database.db has been removed from the project.
7+
8+
The app currently has **4285** manual pages, **22+** basic categories and a bunch of general terminal tips. It works 100% offline, doesn't need an internet connection and has no tracking software.
69

710
[![Play Store](https://raw.githubusercontent.com/SimonSchubert/LinuxCommandBibliotheca/master/art/play_store_badge.png)](https://play.google.com/store/apps/details?id=com.inspiredandroid.linuxcommandbibliotheca)
811
[![F-Droid](https://raw.githubusercontent.com/SimonSchubert/LinuxCommandBibliotheca/master/art/fdroid_badge.png)](https://f-droid.org/en/packages/com.inspiredandroid.linuxcommandbibliotheca/)
@@ -29,7 +32,7 @@ Execute `gradle :cli:buildJar` to create jar file for Linux, Windows and Mac.
2932

3033
#### Categories
3134

32-
One-liners, System information, System control, Users & Groups, Files & Folders, Input, Printing, JSON, Network, Search & Find, GIT, SSH, Video & Audio, Package manager, Hacking tools, Terminal games, Crypto currencies, VIM Texteditor, Emacs Texteditor, Nano Texteditor, Pico Texteditor, Micro Texteditor
35+
Coding Agents, System information, System control, Users & Groups, Files & Folders, Input, Printing, JSON, Network, Search & Find, GIT, SSH, Video & Audio, Package manager, Hacking tools, Terminal games, Crypto currencies, VIM Texteditor, Emacs Texteditor, Nano Texteditor, Pico Texteditor, Micro Texteditor
3336

3437
#### Tips
3538

@@ -49,7 +52,7 @@ Common code unit tests: [CommonTests.kt](common/src/commonTest/kotlin/CommonTest
4952

5053
### Licensing
5154

52-
The source code is licensed under the Apache 2.0 license and the copyright of the man pages in the `database.db` file are copyrighted by their respective authors.
55+
The source code is licensed under the Apache 2.0 license and the copyright of the man pages are copyrighted by their respective authors.
5356

5457
### Thanks to
5558

android/src/main/java/com/inspiredandroid/linuxcommandbibliotheca/IconResources.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,5 +148,6 @@ fun BasicCategory.getIconResource(): Int = when (title) {
148148
"Input" -> R.drawable.ic_icon_mouse
149149
"JSON" -> R.drawable.ic_icon_json
150150
"Fun" -> R.drawable.ic_icon_fun
151+
"Coding Agents" -> R.drawable.ic_agent
151152
else -> R.drawable.ic_icon_mouse
152153
}

android/src/main/java/com/inspiredandroid/linuxcommandbibliotheca/data/BasicsRepository.kt

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.inspiredandroid.linuxcommandbibliotheca.data
22

33
import android.content.Context
4+
import com.linuxcommandlibrary.shared.basicsSortOrder
45

56
class BasicsRepository(private val context: Context) {
67

@@ -19,7 +20,7 @@ class BasicsRepository(private val context: Context) {
1920
null
2021
}
2122
}
22-
.sortedBy { it.title }
23+
.sortedBy { basicsSortOrder.indexOf(it.title) }
2324
}
2425

2526
private fun readCategoryTitle(filename: String): String? = try {
@@ -51,7 +52,7 @@ class BasicsRepository(private val context: Context) {
5152
commandsByGroupId[groupId] = mutableListOf()
5253
commandIndex = 0
5354
}
54-
line.contains("<code>") && currentGroupId != null -> {
55+
line.trim().startsWith("```") && line.trim().endsWith("```") && currentGroupId != null -> {
5556
val (command, mans) = parseCommandLine(line)
5657
val commandId = (categoryId + currentGroupId + commandIndex).hashCode().toLong()
5758
commandsByGroupId[currentGroupId]?.add(
@@ -69,26 +70,18 @@ class BasicsRepository(private val context: Context) {
6970
}
7071

7172
private fun parseCommandLine(line: String): Pair<String, String> {
72-
// Extract command from <code>...</code>
73-
val codeRegex = Regex("<code>(.*?)</code>")
74-
val codeMatch = codeRegex.find(line)
75-
val codeContent = codeMatch?.groupValues?.get(1) ?: ""
73+
// Extract code content from ```...```
74+
val codeContent = line.trim().removeSurrounding("```")
7675

77-
// Extract man links from <a href="/man/xxx">
78-
val manRegex = Regex("""<a href="/man/([^"]+)">""")
76+
// Extract man page names from [text](/man/xxx) links
77+
val manRegex = Regex("""\[([^\]]+)]\(/man/([^)]+)\)""")
7978
val mans = manRegex.findAll(codeContent)
80-
.map { it.groupValues[1] }
79+
.map { it.groupValues[2] }
8180
.distinct()
8281
.joinToString(",")
8382

84-
// Remove HTML tags to get clean command text
85-
val command = codeContent
86-
.replace(Regex("""<a href="[^"]*">"""), "")
87-
.replace("</a>", "")
88-
.replace("&gt;", ">")
89-
.replace("&lt;", "<")
90-
.replace("&amp;", "&")
91-
.trim()
83+
// Remove markdown link syntax to get clean command text
84+
val command = codeContent.replace(manRegex, "$1").trim()
9285

9386
return Pair(command, mans)
9487
}

android/src/main/java/com/inspiredandroid/linuxcommandbibliotheca/data/CommandsRepository.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ class CommandsRepository(private val context: Context) {
4545
)
4646
}
4747

48-
fun getCommand(name: String): CommandInfo? = getCommands().find { it.name == name }
49-
5048
fun hasCommand(name: String): Boolean = getCommands().any { it.name == name }
5149

5250
fun getSections(commandName: String): List<CommandSectionInfo> {
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
package com.inspiredandroid.linuxcommandbibliotheca.ui.composables
2+
3+
import androidx.compose.foundation.layout.padding
4+
import androidx.compose.material.Text
5+
import androidx.compose.runtime.Composable
6+
import androidx.compose.ui.Modifier
7+
import androidx.compose.ui.graphics.Color
8+
import androidx.compose.ui.text.AnnotatedString
9+
import androidx.compose.ui.text.SpanStyle
10+
import androidx.compose.ui.text.buildAnnotatedString
11+
import androidx.compose.ui.text.font.FontStyle
12+
import androidx.compose.ui.text.font.FontWeight
13+
import androidx.compose.ui.text.withStyle
14+
import androidx.compose.ui.unit.Dp
15+
import androidx.compose.ui.unit.dp
16+
import com.linuxcommandlibrary.shared.TextElement
17+
import com.linuxcommandlibrary.shared.TipSectionElement
18+
import kotlinx.collections.immutable.toImmutableList
19+
20+
/* Copyright 2022 Simon Schubert
21+
*
22+
* Licensed under the Apache License, Version 2.0 (the "License");
23+
* you may not use this file except in compliance with the License.
24+
* You may obtain a copy of the License at
25+
*
26+
* http://www.apache.org/licenses/LICENSE-2.0
27+
*
28+
* Unless required by applicable law or agreed to in writing, software
29+
* distributed under the License is distributed on an "AS IS" BASIS,
30+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31+
* See the License for the specific language governing permissions and
32+
* limitations under the License.
33+
*/
34+
35+
fun buildTextElementString(elements: List<TextElement>): AnnotatedString = buildAnnotatedString {
36+
elements.forEach { textElement ->
37+
when (textElement) {
38+
is TextElement.Plain -> append(textElement.text)
39+
is TextElement.Bold -> {
40+
withStyle(style = SpanStyle(fontWeight = FontWeight.Bold)) {
41+
append(textElement.text)
42+
}
43+
}
44+
is TextElement.Italic -> {
45+
withStyle(style = SpanStyle(fontStyle = FontStyle.Italic)) {
46+
append(textElement.text)
47+
}
48+
}
49+
is TextElement.Man -> append(textElement.man)
50+
}
51+
}
52+
}
53+
54+
@Composable
55+
fun TipSectionContent(
56+
sections: List<TipSectionElement>,
57+
onNavigate: (String) -> Unit,
58+
textColor: Color = Color.Unspecified,
59+
commandVerticalPadding: Dp = 0.dp,
60+
) {
61+
sections.forEach { section ->
62+
when (section) {
63+
is TipSectionElement.Text -> {
64+
Text(
65+
text = buildTextElementString(section.elements),
66+
color = textColor,
67+
)
68+
}
69+
70+
is TipSectionElement.Blockquote -> {
71+
Text(
72+
text = buildTextElementString(section.elements),
73+
color = textColor,
74+
modifier = Modifier.padding(start = 8.dp, bottom = 8.dp),
75+
)
76+
}
77+
78+
is TipSectionElement.Code -> {
79+
CommandView(
80+
command = section.command,
81+
elements = section.elements.toImmutableList(),
82+
onNavigate = onNavigate,
83+
verticalPadding = commandVerticalPadding,
84+
)
85+
}
86+
87+
is TipSectionElement.Table -> {
88+
TableView(
89+
headers = section.headers,
90+
rows = section.rows,
91+
onNavigate = onNavigate,
92+
)
93+
}
94+
}
95+
}
96+
}

android/src/main/java/com/inspiredandroid/linuxcommandbibliotheca/ui/screens/commanddetail/CommandDetailScreen.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import androidx.compose.foundation.layout.fillMaxSize
1212
import androidx.compose.foundation.layout.fillMaxWidth
1313
import androidx.compose.foundation.layout.padding
1414
import androidx.compose.foundation.lazy.LazyColumn
15-
import androidx.compose.foundation.lazy.items
15+
import androidx.compose.foundation.lazy.itemsIndexed
1616
import androidx.compose.material.Chip
1717
import androidx.compose.material.ExperimentalMaterialApi
1818
import androidx.compose.material.ListItem
@@ -62,11 +62,11 @@ fun CommandDetailScreen(
6262
val uiState by viewModel.state.collectAsStateWithLifecycle()
6363

6464
LazyColumn(Modifier.fillMaxSize()) {
65-
items(
65+
itemsIndexed(
6666
items = uiState.sections,
67-
key = { it.id },
68-
contentType = { "command_section_item" },
69-
) { section ->
67+
key = { index, _ -> index },
68+
contentType = { _, _ -> "command_section_item" },
69+
) { _, section ->
7070
CommandSectionColumn(
7171
section = section,
7272
isExpanded = uiState.expandedSectionsMap.getOrDefault(section.id, false),
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="24dp"
3+
android:height="24dp"
4+
android:viewportWidth="960"
5+
android:viewportHeight="960">
6+
<path
7+
android:pathData="M440,840v-80h320v-284q0,-117 -81.5,-198.5T480,196q-117,0 -198.5,81.5T200,476v244h-40q-33,0 -56.5,-23.5T80,640v-80q0,-21 10.5,-39.5T120,491l3,-53q8,-68 39.5,-126t79,-101q47.5,-43 109,-67T480,120q68,0 129,24t109,66.5Q766,253 797,311t40,126l3,52q19,9 29.5,27t10.5,38v92q0,20 -10.5,38T840,711v49q0,33 -23.5,56.5T760,840L440,840ZM360,560q-17,0 -28.5,-11.5T320,520q0,-17 11.5,-28.5T360,480q17,0 28.5,11.5T400,520q0,17 -11.5,28.5T360,560ZM600,560q-17,0 -28.5,-11.5T560,520q0,-17 11.5,-28.5T600,480q17,0 28.5,11.5T640,520q0,17 -11.5,28.5T600,560ZM241,498q-7,-106 64,-182t177,-76q89,0 156.5,56.5T720,441q-91,-1 -167.5,-49T435,262q-16,80 -67.5,142.5T241,498Z"
8+
android:fillColor="#1f1f1f"/>
9+
</vector>

assets/basics/codingagents.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Coding Agents
2+
3+
## CLI
4+
```[claude](/man/claude)```
5+
```[opencode](/man/opencode)```
6+
```[copilot](/man/copilot)```
7+
```[grok](/man/grok)```
8+
```[gemini](/man/gemini)```
9+
```[codex](/man/codex)```
10+
```[interpreter](/man/interpreter)```
11+
```[aider](/man/aider)```
12+
```[forge](/man/forge)```
13+
```[vibe](/man/vibe)```
14+
```[crush](/man/crush)```
15+
```[plandex](/man/plandex)```
16+
```[qwen-code](/man/qwen-code)```
17+
```[q](/man/q)```
18+
```[droid](/man/droid)```
19+
```[kimi](/man/kimi)```
20+
```[bondai](/man/bondai)```

assets/basics/cryptocurrencies.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Crypto currencies
2+
3+
## Miners
4+
```[minergate](/man/minergate)```
5+
```[xmrig](/man/xmrig)```
6+
```[bfgminer](/man/bfgminer)```
7+
```[multiminer](/man/multiminer)```
8+
```[awesomeminer](/man/awesomeminer)```
9+
```[cgminer](/man/cgminer)```
10+
```[cardano-node](/man/cardano-node)```
11+
```[polkadot](/man/polkadot)```
12+
```[lotus-miner](/man/lotus-miner)```
13+
```[lnd](/man/lnd)```
14+
15+
## Wallets
16+
```[electrum](/man/electrum)```
17+
```[daedalus](/man/daedalus)```
18+
```[armory](/man/armory)```
19+
```[exodus](/man/exodus)```
20+
```[eidoo](/man/eidoo)```
21+
```[mycrypto](/man/mycrypto)```
22+
```[jaxx](/man/jaxx)```
23+
```[wasabi](/man/wasabi)```
24+
```[mymonero](/man/mymonero)```
25+
```[multidoge](/man/multidoge)```
26+
```[dogecoincore](/man/dogecoincore)```
27+
```[guarda](/man/guarda)```
28+
```[geth](/man/geth)```
29+
30+
## Trading Bots
31+
```[krypto-trading-bot](/man/krypto-trading-bot)```
32+
```[freqtrade](/man/freqtrade)```
33+
```[gekko](/man/gekko)```
34+
```[blackbird](/man/blackbird)```
35+
```[gocryptotrader](/man/gocryptotrader)```
36+
```[hummingbot](/man/hummingbot)```
37+
```[bitvision](/man/bitvision)```
38+
```[tradinggym](/man/tradinggym)```
39+
```[node-binance-trader](/man/node-binance-trader)```
40+
```[octobot](/man/octobot)```
41+
```[r2](/man/r2)```
42+
```[peregrine](/man/peregrine)```
43+
44+
## Coin Tracker
45+
```[cointop](/man/cointop)```
46+
```[coinmon](/man/coinmon)```

0 commit comments

Comments
 (0)