diff --git a/app/src/main/java/io/neoterm/component/NeoInitializer.kt b/app/src/main/java/io/neoterm/component/NeoInitializer.kt index 3da801f..01e3203 100644 --- a/app/src/main/java/io/neoterm/component/NeoInitializer.kt +++ b/app/src/main/java/io/neoterm/component/NeoInitializer.kt @@ -13,6 +13,7 @@ import io.neoterm.component.script.UserScriptComponent import io.neoterm.component.session.SessionComponent import io.neoterm.frontend.logging.NLog import io.neoterm.frontend.component.ComponentManager +import io.neoterm.frontend.session.shell.ShellProfile /** * @author kiva @@ -30,5 +31,8 @@ object NeoInitializer { ComponentManager.registerComponent(PackageComponent::class.java) ComponentManager.registerComponent(SessionComponent::class.java) ComponentManager.registerComponent(ProfileComponent::class.java) + + val profileComp = ComponentManager.getComponent() + profileComp.registerProfile(ShellProfile.PROFILE_META_NAME, ShellProfile::class.java) } } \ No newline at end of file diff --git a/app/src/main/java/io/neoterm/component/profile/NeoProfile.kt b/app/src/main/java/io/neoterm/component/profile/NeoProfile.kt index a876b29..5a1f2f5 100644 --- a/app/src/main/java/io/neoterm/component/profile/NeoProfile.kt +++ b/app/src/main/java/io/neoterm/component/profile/NeoProfile.kt @@ -3,4 +3,6 @@ package io.neoterm.component.profile /** * @author kiva */ -abstract class NeoProfile \ No newline at end of file +abstract class NeoProfile { + abstract val profileMetaName: String +} \ No newline at end of file diff --git a/app/src/main/java/io/neoterm/component/profile/ProfileComponent.kt b/app/src/main/java/io/neoterm/component/profile/ProfileComponent.kt index 18e9eea..2fb4000 100644 --- a/app/src/main/java/io/neoterm/component/profile/ProfileComponent.kt +++ b/app/src/main/java/io/neoterm/component/profile/ProfileComponent.kt @@ -9,7 +9,16 @@ import java.io.File * @author kiva */ class ProfileComponent : NeoComponent { - private val profileList = mutableListOf() + private val profileRegistry = mutableMapOf>() + private val profileList = mutableListOf() + + fun registerProfile(metaName: String, prototype: Class) { + profileRegistry[metaName] = prototype + } + + fun unregisterProfile(metaName: String) { + profileRegistry.remove(metaName) + } private fun checkForFiles() { val profileDir = File(NeoTermPath.PROFILE_PATH) diff --git a/app/src/main/java/io/neoterm/frontend/session/shell/ShellProfile.kt b/app/src/main/java/io/neoterm/frontend/session/shell/ShellProfile.kt index 26b1ecd..2b0ef78 100644 --- a/app/src/main/java/io/neoterm/frontend/session/shell/ShellProfile.kt +++ b/app/src/main/java/io/neoterm/frontend/session/shell/ShellProfile.kt @@ -11,6 +11,12 @@ import io.neoterm.frontend.config.NeoPreference * @author kiva */ class ShellProfile : NeoProfile() { + companion object { + const val PROFILE_META_NAME = "profile-shell" + } + + override val profileMetaName = PROFILE_META_NAME + var loginShell = DefaultValues.loginShell var initialCommand = DefaultValues.initialCommand