Skip to content

Commit

Permalink
rename ccimport -> js import
Browse files Browse the repository at this point in the history
  • Loading branch information
puutaro committed Nov 8, 2023
1 parent e6c8ffb commit 1e35c85
Show file tree
Hide file tree
Showing 13 changed files with 69 additions and 44 deletions.
2 changes: 1 addition & 1 deletion DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ If set, in [edit](https://github.com/puutaro/CommandClick/blob/master/USAGE.md#e

### Import library

-> [CC import](https://github.com/puutaro/CommandClick/blob/master/md/developer/cc_import.md)
-> [js import](https://github.com/puutaro/CommandClick/blob/master/md/developer/js_import.md)

`CommandClick` can import all file with uri. We can use javascript all of the world. This is `CommandClick` basic idea.
`CommandClick` is open world app, as is, web browser, termux client, applicatoin maker, applicatoin store, and library terminal.
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/assets/appSystemDir/system/appDirManager.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@


/// LABELING_SECTION_START
// ccImport admin fannel @puutaro
// App directory manager @puutaro
// --
// --
// bellow setting variable main line up
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@


/// LABELING_SECTION_START
// ccImport admin fannel @puutaro
// jsImport admin fannel @puutaro
// --
// --
// bellow setting variable main line up
Expand All @@ -28,14 +28,14 @@ setReplaceVariables="LIST_PREFIX=prefix"
setReplaceVariables="LIST_SUFFIX=suffix"
setReplaceVariables="CMDCLICK_ROOT_DIR_PATH=${00}"
setReplaceVariables="CMDCLICK_CONF_DIR_PATH=${CMDCLICK_ROOT_DIR_PATH}/conf"
setReplaceVariables="CMDCLICK_CCIMPORT_DIR_PATH=${CMDCLICK_CONF_DIR_PATH}/ccimport"
setVariableTypes="ccImportList:LI=${LIST_DIR_PATH}=${CMDCLICK_CCIMPORT_DIR_PATH}!${LIST_SUFFIX}=.js|menu=delete!get!sync!util&add&write&cat!copy&copy_file&copy_path"
scriptFileName="ccImportManager.js"
setReplaceVariables="CMDCLICK_JS_IMPORT_DIR_PATH=${CMDCLICK_CONF_DIR_PATH}/jsimport"
setVariableTypes="jsImportList:LI=${LIST_DIR_PATH}=${CMDCLICK_JS_IMPORT_DIR_PATH}!${LIST_SUFFIX}=.js|menu=delete!get!sync!util&add&write&cat!copy&copy_file&copy_path"
scriptFileName="jsImportManager.js"
/// SETTING_SECTION_END


/// CMD_VARIABLE_SECTION_START
ccImportList=""
jsImportList=""
/// CMD_VARIABLE_SECTION_END


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ object UsePath {
val cmdclickAppHistoryDirAdminPath = "$rootPath/$cmdclickAppHistoryDirRelativePath"
val cmdclickButtonExecShellFileName = "cmdclickButtonExec$JS_FILE_SUFFIX"
val cmdclickInternetButtonExecJsFileName = "internetButtonExec$JS_FILE_SUFFIX"
private const val cmdclickCcimportDirName = "ccimport"
private val cmdclickCcimportRelativeDirPath = "$cmdclickConfRelativePath/$cmdclickCcimportDirName"
val cmdclickCcimportDirPath = "$rootPath/$cmdclickCcimportRelativeDirPath"
private const val cmdclickJsImportDirName = "jsimport"
private val cmdclickJsImportRelativeDirPath = "$cmdclickConfRelativePath/$cmdclickJsImportDirName"
val cmdclickJsImportDirPath = "$rootPath/$cmdclickJsImportRelativeDirPath"
private const val cmdclickNonitorDirName = "monitor"
private val cmdclickMonitorRelativeDirPath = "$cmdclickConfRelativePath/$cmdclickNonitorDirName"
val cmdclickMonitorDirPath = "$rootPath/$cmdclickMonitorRelativeDirPath"
Expand Down Expand Up @@ -127,8 +127,8 @@ object UsePath {
val fannelSettingDirPath = "\${01}/\${001}/setting"
val homeFannelsFilePath =
"${fannelSettingDirPath}/homeFannelsFilePaths.txt"
val ccImportManagerFannelName = "ccImportManager.js"
val ccImportAdminFannelPath = "$cmdclickSystemAppDirPath/$ccImportManagerFannelName"
val jsImportManagerFannelName = "jsImportManager.js"
val jsImportAdminFannelPath = "$cmdclickSystemAppDirPath/$jsImportManagerFannelName"
val appDirManagerFannelName = "appDirManager.js"
val appDirManagerFannelPath = "$cmdclickSystemAppDirPath/$appDirManagerFannelName"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class CommandIndexFragment: Fragment() {
cmdclickAppHistoryDirAdminPath
)
FileSystems.createDirs(
UsePath.cmdclickCcimportDirPath
UsePath.cmdclickJsImportDirPath
)
FileSystems.createFiles(
cmdclickAppHistoryDirAdminPath,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ object SubMenuDialog {
UsePath.appDirManagerFannelName
)
}
SettingSubMenuEnums.CC_IMPORT.itemName -> {
SettingSubMenuEnums.JS_IMPORT.itemName -> {
SystemFannelLauncher.launch(
commandIndexFragment,
UsePath.cmdclickSystemAppDirPath,
UsePath.ccImportManagerFannelName
UsePath.jsImportManagerFannelName
)
}
SettingSubMenuEnums.SHORTCUT.itemName -> {
Expand Down Expand Up @@ -145,11 +145,11 @@ object SubMenuDialog {
val itemName: String,
val imageId: Int
){
CHDIR("change_app_dir", R.drawable.icons8_support),
CC_IMPORT("cc_import_manager", R.drawable.icons8_folda),
SHORTCUT("create_short_cut", R.drawable.icons8_shortcut),
TERM_REFRESH("term_refresh", R.drawable.icons8_refresh),
TERMUX_SETUP("termux_setup", R.drawable.icons8_setup),
CHDIR("change app dir", R.drawable.icons8_support),
JS_IMPORT("js import manager", R.drawable.icons8_folda),
SHORTCUT("create short cut", R.drawable.icons8_shortcut),
TERM_REFRESH("term refresh", R.drawable.icons8_refresh),
TERMUX_SETUP("termux setup", R.drawable.icons8_setup),
CONFIG("config", R.drawable.icons8_edit),
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import com.puutaro.commandclick.util.ScriptPreWordReplacer
import kotlinx.coroutines.*
import java.io.File

object CcImportManager {
object JsImportManager {

private val importPreWord = "ccimport"
private val importPreWord = "jsimport"
private val assetsPrefix = "/android_asset/"

fun replace(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.puutaro.commandclick.common.variable.variables.CommandClickScriptVari
import com.puutaro.commandclick.common.variable.variant.LanguageTypeSelects
import com.puutaro.commandclick.common.variable.path.UsePath
import com.puutaro.commandclick.proccess.edit.lib.SetReplaceVariabler
import com.puutaro.commandclick.proccess.import.CcImportManager
import com.puutaro.commandclick.proccess.import.JsImportManager
import java.io.File

object JavaScriptLoadUrl {
Expand Down Expand Up @@ -66,7 +66,7 @@ object JavaScriptLoadUrl {
scriptFileName,
)

val setReplaceVariableCompleteMap = makeReplaceVariableTableTsvForCcimport(
val setReplaceVariableCompleteMap = makeReplaceVariableTableTsvForJsImport(
recentAppDirPath,
fannelDirName,
setReplaceVariableMap,
Expand All @@ -77,37 +77,37 @@ object JavaScriptLoadUrl {
var countCmdSectionStart = 0
var countCmdSectionEnd = 0
val loadJsUrl = jsList.map {
val afterCcImport = CcImportManager.replace(
val afterJsImport = JsImportManager.replace(
context,
it,
execJsPath,
setReplaceVariableCompleteMap
)
if(
afterCcImport.startsWith(settingSectionStart)
&& afterCcImport.endsWith(settingSectionStart)
afterJsImport.startsWith(settingSectionStart)
&& afterJsImport.endsWith(settingSectionStart)
) countSettingSectionStart++
if(
afterCcImport.startsWith(settingSectionEnd)
&& afterCcImport.endsWith(settingSectionEnd)
afterJsImport.startsWith(settingSectionEnd)
&& afterJsImport.endsWith(settingSectionEnd)
) countSettingSectionEnd++
if(
afterCcImport.startsWith(commandSectionStart)
&& afterCcImport.endsWith(commandSectionStart)
afterJsImport.startsWith(commandSectionStart)
&& afterJsImport.endsWith(commandSectionStart)
) countCmdSectionStart++
if(
afterCcImport.startsWith(commandSectionEnd)
&& afterCcImport.endsWith(commandSectionEnd)
afterJsImport.startsWith(commandSectionEnd)
&& afterJsImport.endsWith(commandSectionEnd)
) countCmdSectionEnd++
if(
countSettingSectionStart > 0
&& countSettingSectionEnd == 0
) "$afterCcImport;"
) "$afterJsImport;"
else if(
countCmdSectionStart > 0
&& countCmdSectionEnd == 0
) "$afterCcImport;"
else afterCcImport
) "$afterJsImport;"
else afterJsImport
}.joinToString("\n").split("\n").map {
val trimJsRow = it
.trim(' ')
Expand Down Expand Up @@ -330,7 +330,7 @@ object JavaScriptLoadUrl {
)
}

private fun makeReplaceVariableTableTsvForCcimport(
private fun makeReplaceVariableTableTsvForJsImport(
recentAppDirPath: String,
fannelDirName: String,
setReplaceVariableMap: Map<String, String>?,
Expand Down
6 changes: 3 additions & 3 deletions md/developer/directory_structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Table
* [`~/conf`](#conf)
* [`~/conf/AppDirAdmin`](#conf_app_dir_admin)
* [`~/conf/AppHistoryDir`](#conf_app_history_dir)
* [`~/conf/ccimport`](#conf_ccimport)
* [`~/conf/jsimport`](#conf_jsimport)
* [`~/conf/monitor`](#conf_monitor)
* [`~/conf/repository`](#conf_repository)
* [`~/ubuntu`](#ubuntu)
Expand Down Expand Up @@ -79,9 +79,9 @@ Include [fannel](https://github.com/puutaro/CommandClick/blob/master/md/develope

[App history](https://github.com/puutaro/CommandClick/blob/master/USAGE.md#history)

### `~/conf/ccimport` <a id="conf_ccimport"></a>
### `~/conf/jsimport` <a id="conf_jsimport"></a>

Include [cc imported](https://github.com/puutaro/CommandClick/blob/master/DEVELOPER.md#import-library) js library.
Include [js imported](https://github.com/puutaro/CommandClick/blob/master/DEVELOPER.md#import-library) js library.

### `~/conf/monitor` <a id="conf_monitor"></a>

Expand Down
33 changes: 29 additions & 4 deletions md/developer/cc_import.md → md/developer/js_import.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# CC import
# JS import

`CommandClick` can import all file with uri. We can use javascript all of the world. This is `CommandClick` basic idea.
`CommandClick` is open world app, as is, web browser, termux client, applicatoin maker, applicatoin store, and library terminal.
Expand All @@ -10,29 +10,54 @@ Table
* [Local path import](#local-path-import)
* [Assets import](#assets-import)
* [WEB import](#web-import)
* [Enable replace variariables](enable-replace-variariables)


## Local path import

```js.js
ccimport {path}
jsimport {path}
```

* current directory -> `./`
* move parent direcoty -> ../
* other check [Javascript pre reserved word](https://github.com/puutaro/CommandClick/blob/master/md/developer/js_pre_reserved_word.md)


## Assets import

```js.js
ccimport /android_asset/{relative path}
jsimport /android_asset/{relative path}
```


## WEB import

```js.js
ccimport {URL}
jsimport {URL}
```

* It is possible to download by curl {URL}


## Enable replace variariables

ex1) local js script

```js.js
jsimport "{replace variable name}/libs/test.js"
```

ex2) assets

```js.js
jsimport /android_asset/{replace variable name for asset}
```

ex3) WEB

```js.js
jsimport {replace variable name for url}
```

-> [Replace variariables](https://github.com/puutaro/CommandClick/blob/master/md/developer/set_replace_variables.md)

0 comments on commit 1e35c85

Please sign in to comment.