-
Notifications
You must be signed in to change notification settings - Fork 117
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
Auto-creating folders in logging path #20
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,15 +4,17 @@ CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
|
||
source "$CURRENT_DIR/variables.sh" | ||
source "$CURRENT_DIR/shared.sh" | ||
source "$CURRENT_DIR/capture_pane_helpers.sh" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The helpers in this file should only be included in files that handle "capture pane" features. If
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After looking at this more I think this would be clean:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I will think about it |
||
|
||
get_filename() { | ||
local logging_path="$(get_tmux_option "$logging_path_option" "$default_logging_path")" | ||
local logging_filename="$(get_tmux_option "$logging_filename_option" "$default_logging_filename")" | ||
echo "${logging_path}/${logging_filename}" | ||
} | ||
# Functions defined in capture_pane_helpers are customized via below variables. | ||
default_path="$default_logging_path" | ||
default_name="$default_logging_filename" | ||
|
||
path_option="$logging_path_option" | ||
name_option="$logging_filename_option" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just reviewed how and why are these variables defined. I must say it was a lousy decision on my part to set this "global state" that is then used implicitly in functions defined in If you have a suggestion how to refactor this, that would be welcome. I think we just want to pass all arguments to functions explicitly. For example, instead of just There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you wanna refactor this, let's do it in a separate PR. No need to do all at once. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the advice. I will create separate PR for refactoring this |
||
|
||
start_pipe_pane() { | ||
local filename="$(get_filename)" | ||
local filename="$(get_path)/$(get_filename)" | ||
"$CURRENT_DIR/start_logging.sh" "$filename" | ||
display_message "Started logging to $filename" | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this line do? Why can't you just use
path_template
variable on the 2 lines below?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason of this is that path_template contains "%Y-%m-%d" which we need to convert real values. It can be done only through tmux display-message because bash doesn't know about this anything