Browse Source

Default win_edit to new file

cere 2 months ago
parent
commit
bf449ec905
1 changed files with 7 additions and 4 deletions
  1. 7 4
      win_edit

+ 7 - 4
win_edit

@@ -1,16 +1,19 @@
 #!/usr/bin/env bash
 # open_scite.sh
 # Usage:
-#   ./open_scite.sh /path/to/file [line_number] [column_number]
+#   ./open_scite.sh [/path/to/file] [line_number] [column_number]
+# If no path is provided, a new file named new_file.md is opened in the
+# current directory.
 
 set -euo pipefail
 
-if [[ $# -lt 1 || $# -gt 3 ]]; then
-  echo "Usage: $0 <linux_path_to_file> [line_number] [column_number]"
+if [[ $# -gt 3 ]]; then
+  echo "Usage: $0 [linux_path_to_file] [line_number] [column_number]"
   exit 1
 fi
 
-FILE_LINUX="$1"
+DEFAULT_FILE="$PWD/new_file.md"
+FILE_LINUX="${1:-$DEFAULT_FILE}"
 LINE="${2:-}"
 COL="${3:-}"