Skip to content

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

@Kreyren

Description

@Kreyren

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions