toyotacorolla

vroom
git clone https://git.davidvoz.net/toyotacorolla.git
index
logs
tree

commit 3a744d1636f7f55e82715e1cd185c5a5ac93afee
Author: David Voznyarskiy <31452046-davidvoz@users.noreply.gitlab.com>
Date:   Thu Jan 1 13:24:11 2026 -0800

    added random words option

diff --git a/rand b/rand
index 9a3ea4d..9eda9ed 100755
--- a/rand
+++ b/rand
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/env bash
generate_string_azAZ09Symb() { local length=$1 @@ -21,7 +21,7 @@ clip() { echo "$(generate_string_azAZ09Symb)" }
-name(){
+name() {
local length=$1 local file=$2 @@ -38,6 +38,7 @@ name(){ naming_option=0 clip_option=0 num_chars=0
+words_option=0
target_file="" while [[ "$1" =~ ^- ]]; do @@ -75,6 +76,19 @@ while [[ "$1" =~ ^- ]]; do exit 1 fi ;;
+ -w|--words)
+ words_option=1
+ shift
+ if [[ -n "$1" && "$1" =~ ^[0-9]+$ ]]; then
+ num_words=$1
+ shift
+ else
+ echo "invalid or missing argument for -w option"
+ echo "select -h option for help"
+ print_help
+ exit 1
+ fi
+ ;;
-h|--help) print_help exit 0 @@ -86,7 +100,7 @@ while [[ "$1" =~ ^- ]]; do esac done
-if [ $naming_option -eq 1 ]; then
+if [[ $naming_option -eq 1 ]]; then
if [[ -n "$num_chars" && -n "$target_file" ]]; then name "$num_chars" "$target_file" exit 0 @@ -95,7 +109,7 @@ if [ $naming_option -eq 1 ]; then print_help exit 1 fi
-elif [ $clip_option -eq 1 ]; then
+elif [[ $clip_option -eq 1 ]]; then
if [[ -n "$num_chars" ]]; then random_string=$(generate_string_azAZ09Symb "$num_chars") echo "$random_string" | xclip -selection clipboard @@ -105,6 +119,16 @@ elif [ $clip_option -eq 1 ]; then print_help exit 1 fi
+elif [[ $words_option -eq 1 ]]; then
+ if [[ -n "$num_words" ]]; then
+ random_string=$(shuf -n $num_words /etc/dictionaries-common/words | tr '\n' ' ')
+ echo "$random_string" | xclip -selection clipboard
+ echo "copied"
+ exit 0
+ else
+ print_help
+ exit 1
+ fi
fi if [[ $# -gt 0 && "$1" =~ ^[0-9]+$ ]]; then