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

Add friends edit command #112

Merged
merged 1 commit into from
May 1, 2016
Merged
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
14 changes: 12 additions & 2 deletions bin/friends
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@ switch [:debug],
desc "Updates the `friends` program"
command :update do |update|
update.action do
search = `gem search friends`
# rubocop:disable Lint/AssignmentInCondition
if match = search.match(/^friends\s\(([^\)]+)\)$/)
if match = `gem search friends`.match(/^friends\s\(([^\)]+)\)$/)
# rubocop:enable Lint/AssignmentInCondition
remote_version = match[1]
if Semverse::Version.coerce(remote_version) >
Expand All @@ -56,6 +55,17 @@ command :update do |update|
end
end

desc "Opens the `friends.md` file in $EDITOR for manual editing"
command :edit do |edit|
edit.action do |global_options|
editor = ENV["EDITOR"] || "vim"
filename = global_options[:filename]

puts "Opening \"#{filename}\" in #{editor}" unless global_options[:quiet]
Kernel.exec "#{editor} #{filename}"
end
end

desc "Lists friends, activities, and locations"
command :list do |list|
list.desc "List all friends"
Expand Down