This repository has been archived by the owner on Feb 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7d824a9
commit 02f420c
Showing
3 changed files
with
66 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,38 @@ | ||
module Svgeez | ||
class Command | ||
def self.subclasses | ||
@subclasses ||= [] | ||
end | ||
class << self | ||
def subclasses | ||
@subclasses ||= [] | ||
end | ||
|
||
def self.inherited(base) | ||
subclasses << base | ||
super(base) | ||
end | ||
def inherited(base) | ||
subclasses << base | ||
super(base) | ||
end | ||
|
||
def init_with_program(program) | ||
program.command(name.downcase.to_sym) do |command| | ||
command.description command_description | ||
command.syntax command_syntax | ||
|
||
add_actions(command) | ||
add_options(command) | ||
end | ||
end | ||
|
||
private | ||
|
||
def add_actions(command) | ||
command.action do |_, options| | ||
command_action(options) | ||
end | ||
end | ||
|
||
def self.add_build_options(command) | ||
command.option 'source', '-s', '--source [FOLDER]', 'Source folder (defaults to ./_svgeez)' | ||
command.option 'destination', '-d', '--destination [OUTPUT]', 'Destination file or folder (defaults to ./svgeez.svg)' | ||
command.option 'svgo', '--with-svgo', 'Optimize source SVGs with SVGO before sprite generation (non-destructive)' | ||
def add_options(command) | ||
command.option 'source', '-s', '--source [FOLDER]', 'Source folder (defaults to ./_svgeez)' | ||
command.option 'destination', '-d', '--destination [OUTPUT]', 'Destination file or folder (defaults to ./svgeez.svg)' | ||
command.option 'svgo', '--with-svgo', 'Optimize source SVGs with SVGO before sprite generation (non-destructive)' | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters