[RFC,v1,1/8] dts: merge DTS format.sh to DPDK

Message ID 20220406153151.2917346-2-juraj.linkes@pantheon.tech (mailing list archive)
State RFC, archived
Delegated to: Thomas Monjalon
Headers
Series merge DTS repo config and tools to DPDK |

Checks

Context Check Description
ci/checkpatch warning coding style issues

Commit Message

Juraj Linkeš April 6, 2022, 3:31 p.m. UTC
  ---
 dts/format.sh | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100755 dts/format.sh
  

Patch

diff --git a/dts/format.sh b/dts/format.sh
new file mode 100755
index 0000000000..d35c0bf1da
--- /dev/null
+++ b/dts/format.sh
@@ -0,0 +1,35 @@ 
+#!/usr/bin/env bash
+
+function main() {
+    # The directory to work on is either passed in as argument 1,
+    # or is the current working directory
+    DIRECTORY=${1:-`pwd`}
+    LINE_LENGTH=88
+
+    isort \
+      --overwrite-in-place \
+      --profile black \
+      -j `nproc` \
+      --line-length $LINE_LENGTH \
+      --python-version auto \
+      $DIRECTORY
+
+    black \
+      --line-length $LINE_LENGTH \
+      --required-version 22.1.0 \
+      --target-version py38 \
+      --safe \
+      $DIRECTORY
+}
+
+function help() {
+  echo "usage: format.sh <directory>"
+}
+
+if [ "$1" == "-h" ] || [ "$1" == "--help" ]; then
+  help
+  exit 0
+fi
+
+main "$1"
+