From 39cf7e442efd7d99f30f7447031acdea83fa9a2b Mon Sep 17 00:00:00 2001 From: Sayan Dutta Date: Sun, 25 Jun 2017 18:51:46 +0530 Subject: [PATCH] v2.8 from the old code base changelog > setting "c_char" variable now can change the character which the system uses to recognize global variables --- FileSystem.fs | Bin 2951 -> 2951 bytes bin/copy.py | 2 +- bin/echo.py | 6 +++--- bin/help.py | 2 +- bin/move.py | 2 +- bin/set.py | 2 +- lib/.configs | 1 + lib/lock.key | 1 - lib/utils.py | 11 +++++++---- 9 files changed, 15 insertions(+), 12 deletions(-) delete mode 100644 lib/lock.key diff --git a/FileSystem.fs b/FileSystem.fs index 87f3dbb38ab463703c10adae26777a85ce173d33..8ad402d2fd93df7e0ff94cbaec7acd8d962f561e 100644 GIT binary patch delta 299 zcmZn{Zx`na@MdNaVPIh3V9=R%(`zDMFbkMYy~4%-7MX0%r~nq4oXq$Y%-9^mB+3X8 zDrG(dVOX;~fH34)_d^(uSeHW>y=+Dh#$mSAFf&WoRUu+?+1+4bFWF^bOdbw7h_oJu zHH4ANVFr_2$zcEyyUSq#VMuZsLl^;^CJ;skC)Cb;Fvb^{8f`99h?*2GJD8CxU}6us P%wb}3+`2GkAh#I+KKW%k delta 299 zcmZn{Zx`na@MdNaVPIh3V3-ko&ut=KFbkMYy}||&nQYIf02Z2@%=i_|*c`(o$_NoE zWj+L9ShGBUFyvYHLl}=(mqQr6Y(@~qVYbyUGfUW2A!2jc-C$xb*=1o&9u7H(v>t~w zgptc(29sRLVE_@k%V7awNOBrO7y+Cn5Jm?l)Xse{#uu0xZ7x%YniMWOn2{@BVh_2@ OVPbOJx-e!Sw;2G(4r^Bc diff --git a/bin/copy.py b/bin/copy.py index e081379..486c520 100644 --- a/bin/copy.py +++ b/bin/copy.py @@ -20,7 +20,7 @@ def main(argv): return args = get_args(argv) - # The shell does the work of replacing + #The shell does the work of replacing #vars already. Code segment below #is not required anymore. #args = replace_vars(args) diff --git a/bin/echo.py b/bin/echo.py index 1dff9a1..b38bd0e 100644 --- a/bin/echo.py +++ b/bin/echo.py @@ -24,7 +24,7 @@ def main(argv): _help() return # The shell doesnt send the - # command name in the arg list + #command name in the arg list #so the next line is not needed #anymore #argv.pop(0) @@ -47,8 +47,8 @@ def main(argv): # The shell does the work of replacing # vars already. Code segment below # is not required anymore. - # argv=replace_vars(argv) - + #argv=replace_vars(argv) + #make the string if len(argv) != 0: s = make_s(argv) diff --git a/bin/help.py b/bin/help.py index 85002ee..954d244 100644 --- a/bin/help.py +++ b/bin/help.py @@ -23,7 +23,7 @@ v = ''' [version] -v2.7a +v2.8 [author] Sayan Dutta diff --git a/bin/move.py b/bin/move.py index 296725d..81fab5f 100644 --- a/bin/move.py +++ b/bin/move.py @@ -19,7 +19,7 @@ def main(argv): return args = get_args(argv) - # The shell does the work of replacing + #The shell does the work of replacing #vars already. Code segment below #is not required anymore. #args = replace_vars(args) diff --git a/bin/set.py b/bin/set.py index 7ad4401..26cd3d8 100644 --- a/bin/set.py +++ b/bin/set.py @@ -37,7 +37,7 @@ def main(argv): try: var = argv[1] #detect system vars - if var == 'save_state': + if var == 'save_state' or var == 'c_char': err(4, add='Cant delete system variable "' + var+'"') return prop.delete(var) diff --git a/lib/.configs b/lib/.configs index c7ce6e9..1e99ed8 100644 --- a/lib/.configs +++ b/lib/.configs @@ -6,4 +6,5 @@ save_state = 0 prompt = -def exit = exit -t 0 secho = fwd echo +c_char = $ diff --git a/lib/lock.key b/lib/lock.key deleted file mode 100644 index 9e50edf..0000000 --- a/lib/lock.key +++ /dev/null @@ -1 +0,0 @@ -9d4e1e23bd5b727046a9e3b4b7db57bd8d6ee684 diff --git a/lib/utils.py b/lib/utils.py index 0bfdd3f..d2eb0e9 100644 --- a/lib/utils.py +++ b/lib/utils.py @@ -145,7 +145,7 @@ def vars(self): def delete(self, var): config = cp.ConfigParser() config.read(c_path) - section = 'Property' + section='Property' if config.has_option(section,var): config.remove_option(section,var) with open(c_path,'w') as configs: @@ -161,10 +161,13 @@ def __repr__(self): #algorithm to replace vars with values def replace_vars(argv): + if prop.get('c_char') != NULL: + c_char = prop.get('c_char') + else: c_char = '%' for i in range(len(argv)): var = argv[i] - v = var.replace('%', '') - if '%' in var and v in prop.vars(): + v = var.replace(c_char, '') + if c_char in var and v in prop.vars(): #print(i, var, v) argv.pop(i) argv.insert(i,prop.get(v)) @@ -283,7 +286,7 @@ def analyze(inp): Basic function to analyze the input for other expressions returns None''' - # The shell doesnt send the command + #The shell doesnt send the command #name in arg list anymore #so next line is not required #inp=make_s(inp)