Skip to content

ShiroNeri4u/Shell-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Shell-

A Simple Shell Script Extension. Testing in Android shell environment, can be used in sh/bash/zsh/fish.

Usage

# Initialization script
source toolkit
InitToolkit

# Defind class
@DefClass ExampleClass

 # Defind attribute

 @DefAttribute ExampleAttribute

 # Defind method
 @DefMethod PrintMethodName
 ExampleClass::PrintMethodName() {
 echo "The Attribute is $This_ExampleAttribute."
 }

 # The constructor function
 ExampleClass::ExampleClass() {
 This_ExampleAttribute=$1
 }

# Create a object
 @New ExampleClass ExampleObject hello

# Use object method
 ExampleObject.PrintMethodName

# Defind sub class
 @DefClass AnotherClass : ExampleClass
  @DefAttribute AnotherAttribute
  AnotherClass::AnotherClass() {
  this.ExampleClass $1
  this_AnotherAttribute=$2
  }

  @DefMethod AnotherMethod
  AnotherClass::AnotherMethod() {
  echo "$this_ExampleAttribute $this_AnotherAttribute"
  }

 @New AnotherClass AnotherObject hello world!

# Type of object

 @Typeof ExampleObject

# Object instance id

 echo $ExampleObject

# Destory object
 @Destory ExampleObject
 @Destory AnotherObject

About

A Simple Shell Script Extension

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published