GitBucket
4.20.0
Toggle navigation
Sign in
Files
Branches
1
Tags
Issues
Pull requests
Labels
Priorities
Milestones
Wiki
Forks
Jonathan
/
note
Browse code
Updated README.md and help.
master
1 parent
a39f4f9
commit
27b48f4bb98ff2aa2a4736741573c89d38076ee2
Jonathan Ström
authored
on 7 Mar 2017
Patch
Showing
2 changed files
README.md
note
Ignore Space
Show notes
View
README.md
### Installation Run this command in your terminal to install note to your path. `sudo ./note-install` ### Usage `note [--setfile <filepath>] [--less|--vi|--gedit|--help|--author|--version]` ### Commands `--setfile:` Set new temporary location of file `--less` Show contents using "less" `--vi` Edit contents using "vi" `--gedit` Edit contents using "gedit" `--location` Show file location `--help` Show this help message `--author` Show the author `--version` Show current version ### Examples `note [leave empty or a command]` Just like --setfile, but default value '$filename'. `note This is a message that will be added to the notefile with date.` You can create notes that are one line by directly typing it after note. `note --setfile <filepath> [leave empty or a command]` Will open note just as before, but using <filepath> instead. ### Commands `:q` - exit the program `:exit` - exit the program `:less` - will show the notefile with the `less` command.
Run this command to install note to your path. ### Installation `sudo ./note-install` ### Usage `note [text]` - will one row of text to the notefile. `note less` - will show everything in the notefile with the `less`-command. `note` - will let you type anything until a command is entered. ### Commands `:q` - exit `:exit` - exit `:less` - will show the notefile with the `less` command.
Ignore Space
Show notes
View
note
#!/bin/bash author="Livila" version="2.0" filename=~/notefile para="$1" if [ "$1" == "--setfile" ]; then # Check if the file location is entered, exit if not. if [[ -z $2 ]]; then exit 1 fi filename=$2 para=$3 fi # Check if there is any arguments, if there is append all of it. case "$para" in --less) less $filename exit 1 ;; --edit) vi $filename exit 1 ;; --vi) vi $filename exit 1 ;; --gedit) gedit $filename exit 1 ;; --location) echo "$filename"; exit 1 ;; --author) echo "The author of this program is $author."; exit 1 ;; --version) echo "Version $version"; exit 1 ;; --help) echo -e 'Usage: note [--setfile <filepath>] [--less|--vi|--gedit|--help|--author|--version] Commands: --setfile: Set new temporary location of file --less Show contents using "less" --vi Edit contents using "vi" --gedit Edit contents using "gedit" --location Show file location --help Show this help message --author Show the author --version Show current version Examples: note [leave empty or a command] Just like --setfile, but default value '$filename'. note This is a message that will be added to the notefile with date. You can create notes that are one line by directly typing it after note. note --setfile <filepath> [leave empty or a command] Will open note just as before, but using <filepath> instead. '; exit 1 ;; # If there are no parameters entered. "") echo 'Enter input or type :exit or :q to exit. :less to show contents.' read input saveDateOnce=0 # Loop until :exit or :q is entered. while [ "$input" != ":exit" ] && [ "$input" != ":q" ]; do # In case you want to have a quick overview of your text. if [ "$input" == ":less" ]; then less $filename else # Check if the date has been saved. if [ $saveDateOnce == 0 ]; then date >> $filename saveDateOnce=1 fi echo "$input" >> $filename fi read input done ;; # Save an instant note. *) date >> $filename if [ "$1" == "--setfile" ]; then # Start from the third input parameter and write to the file. echo "${@:3}" >> $filename else # Write all parameters entered to the file. echo "$@" >> $filename fi exit 1 ;; esac
#!/bin/bash author="Livila" version="2.0" filename=~/notefile para="$1" if [ "$1" == "--setfile" ]; then # Check if the file location is entered, exit if not. if [[ -z $2 ]]; then exit 1 fi filename=$2 para=$3 fi # Check if there is any arguments, if there is append all of it. case "$para" in --less) less $filename exit 1 ;; --edit) vi $filename exit 1 ;; --vi) vi $filename exit 1 ;; --gedit) gedit $filename exit 1 ;; --location) echo "$filename"; exit 1 ;; --author) echo "The author of this program is $author."; exit 1 ;; --version) echo "Version $version"; exit 1 ;; --help) echo -e 'Usage: note [--setfile <filepath>] [--less|--vi|--gedit|--help|--author|--version] Commands: --setfile: Set new temporary location of file --less Show contents using "less" --vi Edit contents using "vi" --gedit Edit contents using "gedit" --location Show file location --help Show this help message --author Show the author --version Show current version Examples: note Will open the note and save the notes to '$filename'. note This is a message that will be added to the notefile. You can create notes that are one line by directly typing it after note. note --setfile <filepath> Will open note just as before, but using <filepath> instead. note --setfile <filepath> --less Will show <filepath> using the less command. '; exit 1 ;; # If there are no parameters entered. "") echo 'Enter input or type :exit or :q to exit. :less to show contents.' read input saveDateOnce=0 # Loop until :exit or :q is entered. while [ "$input" != ":exit" ] && [ "$input" != ":q" ]; do # In case you want to have a quick overview of your text. if [ "$input" == ":less" ]; then less $filename else # Check if the date has been saved. if [ $saveDateOnce == 0 ]; then date >> $filename saveDateOnce=1 fi echo "$input" >> $filename fi read input done ;; # Save an instant note. *) date >> $filename if [ "$1" == "--setfile" ]; then # Start from the third input parameter and write to the file. echo "${@:3}" >> $filename else # Write all parameters entered to the file. echo "$@" >> $filename fi exit 1 ;; esac
Show line notes below