Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QA: codestyle oneline (kreystyle) vs if..fi #3

Open
Kreyren opened this issue Sep 28, 2019 · 0 comments
Open

QA: codestyle oneline (kreystyle) vs if..fi #3

Kreyren opened this issue Sep 28, 2019 · 0 comments
Assignees

Comments

@Kreyren
Copy link
Member

Kreyren commented Sep 28, 2019

Kreystyle

Abstract: Write shell/bash as effective as possible where efficiency is defined as fastest to write without mistakes and easy to read for writer and then for others with ethicacy to change the style if more effective way is proved thus feedback is welcomed with attempt to provide bash to shell compatibility where possible and assuming usage of API (https://github.com/RXT067/Scripts/tree/kreyren/kreypi) to allow passive improvements of the code.

TODO: Colemak keyboard is possible improvement for writing speed


## Current
[ ! -e '/usr/src/Wine_Appimage/build' ] && { mkdir '/usr/src/Wine_Appimage/build' || die '1' 'mkdir failed to make a new directory in /usr/src/Wine_appimage/build' ; } || debug "Directory '/usr/src/Wine_Appimage/build' already exists"

# Proposed
if [ ! -e '/usr/src/Wine_Appimage/build' ] &&
  ! mkdir '/usr/src/Wine_Appimage/build'; then
    die '1' 'mkdir failed to make a new directory in /usr/src/Wine_appimage/build'
elif [ ! -e '/usr/src/Wine_Appimage/build' ]; then
    debug "file '/usr/src/Wine_Appimage/build' already exists"
fi

investigate!

Assuming softwrap for one-line

Users with narrow terminal are concern
image

Current decision

Oneline (kreystyle)

+ oneline is faster by 2s to write
+ is shorter
- harder to read on wide terminal

Use only for short logic

if..fi

+ is more readable for more complicated logic
- takes by 2s longer to write in comparison to oneline

For longer logic if..fi should be used since it's more readable

@Kreyren Kreyren self-assigned this Sep 28, 2019
@Kreyren Kreyren changed the title QA: codestyle oneline vs if..fi QA: codestyle oneline (kreystyle) vs if..fi Sep 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant