Sha256: eac6649afdc84c33af6260aeb9f8508c1e04d3de87b4f5b09a727d93ab311382
Contents?: true
Size: 1.85 KB
Versions: 6
Compression:
Stored size: 1.85 KB
Contents
# -*- coding: UTF-8 -*- require 'build-tool/commands' require 'build-tool/recipe' require 'mj/path' require 'fileutils' module BuildTool; module Commands; module Recipes # # BuildCommand # class Edit < Standard name "edit" description "Edit the recipe." long_description [ "Opens the recipe in a editor (or file browser). By default opens the override file.", "The command uses xdg-open." ] def applicable? BuildTool::Application.instance.has_recipe? end def initialize_options options.banner = "Usage: #{self.fullname} RECIPE [OPTIONS]... MODULE" options.separator( "" ) options.separator( "Options" ) @global = false options.on( "-g", "--global", "Open the recipe." ) { |t| @global = t } @browser = false options.on( "-b", "--browser", "Open a file browser." ) { |t| @browser = t } super end def do_execute( args ) if ( args.length > 0 ) return usage( args.length == 0 ? "Not enough arguments" : "To many arguments" ) end rec = BuildTool::Application::instance.recipe if @global if @browser MJ::Path::open( rec.global_path ) else MJ::Path::open( rec.global_config_file_path( 'recipe' ) ) end else if @browser MJ::Path::open( rec.local_path() ) else MJ::Path::open( rec.local_config_file_path( 'recipe' ) ) end end return 0 end end # class end; end # module Commands::Recipes end; # module BuildTool
Version data entries
6 entries across 6 versions & 1 rubygems