commit - db1540d9f26c7f85b8930effd962726255d49b43
commit + 38c5f1b2c76d279c8847ab505b69c8aa191229b3
blob - ec62d4f59c2b52338db757c3c8fad69baf68e0e1
blob + 1f89a8f0740fe6a77a51e73bd13e37152f7f867e
--- nwpg.sh
+++ nwpg.sh
# named after the project and three files:
# the algorithm, the code, the documentation,
# i.e. main.algo, main.c, main.doc
-
-touch $HOME/hack/$1/main.{,doc,algo} ;
-
#
-# TODO
-# Add support for choosing language
-# i.e. either C, Python, Rust, &tc.
-#
+# syntax: nwpg [language] project_title
-case $1 in
- C || c )
- file_ext="c" ;;
- Python || Py || py )
- file_ext="py" ;;
- Rust )
- file_ext=""
- echo "Rust project" ;;
- * )
- file_ext="" ;;
+case $# in
+ 0 )
+ echo "Usage: nwpg [language] project_title" ;;
+ 1 )
+ project_title="$1" ;;
+ 2)
+ project_title="$2" ;
+ case $1 in
+ C | c )
+ file_ext="c" ;;
+ Python | Py | py )
+ file_ext="py" ;;
+ Rust )
+ file_ext=""
+ echo "Rust project" ;;
+ * )
+ file_ext="" ;;
+ esac ;;
esac
+mkdir -p $HOME/hack/$project_title ;
+touch $HOME/hack/$project_title/main.{$file_ext,doc,algo} ;
+
+#
+# TODO
+# Add help displayed using -h
+# or when no argument is provided
+#
+