mirror of
https://github.com/donovanglover/nix-config.git
synced 2025-06-20 01:38:02 +02:00
Add more specific instructions for the maid program
This commit is contained in:
parent
ba9f484e51
commit
2222d9b589
53
bin/maid
53
bin/maid
@ -51,44 +51,31 @@ module Maid
|
|||||||
given_command.delete!("-")
|
given_command.delete!("-")
|
||||||
|
|
||||||
if given_command == "help" or given_command == "h" then
|
if given_command == "help" or given_command == "h" then
|
||||||
Maid.help() # Show maid help
|
Maid.help()
|
||||||
end
|
end
|
||||||
|
|
||||||
if given_command == "up" or given_command == "u" then
|
if given_command == "up" or given_command == "u" then
|
||||||
Maid.up() # Push all your local changes upstream
|
Maid.up()
|
||||||
# To only push a specific file, use maid up <filename>
|
|
||||||
# TODO: use fuzzy matching to find the filename? If more than one
|
|
||||||
# file is found, don't do anything and instead ask the user to specify
|
|
||||||
# which one (i.e. with the full (relative?) path)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if given_command == "down" or given_command == "d" then
|
if given_command == "down" or given_command == "d" then
|
||||||
Maid.down() # Pull your upstream changes to the local filesystem
|
Maid.down()
|
||||||
# To only pull a specific file, use maid down <filename>
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if given_command == "status" or given_command == "s" then
|
if given_command == "status" or given_command == "s" then
|
||||||
Maid.status() # Show all the files that differ from upstream
|
Maid.status()
|
||||||
# Use maid s <filename> to view a simple diff between the two files
|
|
||||||
# TODO: Show different things for files that don't exist and files
|
|
||||||
# that have been changed
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if given_command == "diff" or given_command == "f" then
|
if given_command == "diff" or given_command == "f" then
|
||||||
Maid.diff() # Open both files in vimdiff
|
Maid.diff()
|
||||||
# This allows you to see and edit the files in detail
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if given_command == "add" or given_command == "a" then
|
if given_command == "add" or given_command == "a" then
|
||||||
Maid.add() # Add a specific file to upstream
|
Maid.add()
|
||||||
# This allows you to track dotfiles that aren't in your upstream yet
|
|
||||||
# TODO: This should fail if the file already exists
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if given_command == "remove" or given_command == "r" then
|
if given_command == "remove" or given_command == "r" then
|
||||||
Maid.remove() # Remove a specific file from upstream
|
Maid.remove()
|
||||||
# This removes a file from your upstream, preventing it from being tracked
|
|
||||||
# NOTE: the local file remains the same; only the upstream file is removed
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@ -99,32 +86,46 @@ module Maid
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.up()
|
def self.up()
|
||||||
puts "Up"
|
# If no file was given:
|
||||||
|
# > For each file in upstream
|
||||||
|
# > If the file in upstream does not match the file downstream
|
||||||
|
# > Replace the file upstream with the file downstream
|
||||||
|
# If a file was given:
|
||||||
|
# > Look for <filename> with fuzzy matching
|
||||||
|
# > If exactly one match is found
|
||||||
|
# > If the file upstream does not match the file downstream
|
||||||
|
# > Replace the file upstream with the file downstream
|
||||||
|
# > Else
|
||||||
|
# > The search was too generic, show all results and ask the
|
||||||
|
# user to narrow down the search
|
||||||
exit 0
|
exit 0
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.down()
|
def self.down()
|
||||||
puts "Down"
|
# The same as up() but updates the file downstream with the file upstream
|
||||||
exit 0
|
exit 0
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.status()
|
def self.status()
|
||||||
puts "Status"
|
# If no file was given:
|
||||||
|
# > For each file in upstream, if us != ds then print the file as one that differs
|
||||||
|
# Note that files downstream may be different or simply may not exist, so handle both cases
|
||||||
|
# Otherwise a file was given, so show a simple diff between the two files (both ways)
|
||||||
exit 0
|
exit 0
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.diff()
|
def self.diff()
|
||||||
puts "Diff"
|
# See a comparison between upstream and downstream in vimdiff (same as nvim -d)
|
||||||
exit 0
|
exit 0
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.add()
|
def self.add()
|
||||||
puts "Add"
|
# Add a specific file from downstream to upstream; fails if the file already exists
|
||||||
exit 0
|
exit 0
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.remove()
|
def self.remove()
|
||||||
puts "Remove"
|
# Remove a specific file from upstream, preventing it from being tracked
|
||||||
exit 0
|
exit 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user