Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow log file names to be passed as argument to start logging. #59

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions scripts/toggle_logging.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/usr/bin/env bash
# Log filename may be passed as an argument optionally.
# If none passed, the new log file will be created per the configuration
# guide.

CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

Expand All @@ -7,9 +10,10 @@ source "$CURRENT_DIR/shared.sh"


start_pipe_pane() {
local file=$(expand_tmux_format_path "${logging_full_filename}")
local fname=$(expand_tmux_format_path "${logging_full_filename}")
local file=${1:-$fname}
"$CURRENT_DIR/start_logging.sh" "${file}"
display_message "Started logging to ${logging_full_filename}"
display_message "Started logging to ${file}"
}

stop_pipe_pane() {
Expand Down Expand Up @@ -47,13 +51,14 @@ toggle_pipe_pane() {
stop_pipe_pane
else
set_logging_variable "logging"
start_pipe_pane
start_pipe_pane $1
fi
}

main() {
if supported_tmux_version_ok; then
toggle_pipe_pane
toggle_pipe_pane $1
fi
}
main
# if argument is passed, treat it as the logfilename
main $1