lib/hook/hookapp.rb
# Get a list of all hooks on a file/url.
Get a list of all hooks on a file/url.
Get a list of all hooks on a file / url .
def linked_bookmarks(args, opts)
    result = []
    separator = args.length == 1 && opts[:format] == 'paths' && opts[:null_separator] ? "\0" : "\n"
    if args.nil? || args.empty?
      result = output_array(all_bookmarks, opts)
    else
      args.each do |url|
        source_mark = bookmark_for(url)
        filename = source_mark[:name]
        case opts[:format]
        when /^m/
          filename = "[#{source_mark[:name]}](#{source_mark[:url]})"
          filename += " <file://#{CGI.escape(source_mark[:path])}>" if source_mark[:path]
        when /^p/
          filename = "File: #{source_mark[:name]}"
          filename += " (#{source_mark[:path]})" if source_mark[:path]
        when /^h/
          filename = "File: #{source_mark[:name]}"
          filename += " (#{source_mark[:url]})" if source_mark[:url]
        else
          filename = "Bookmarks attached to #{source_mark[:path] || source_mark[:url]}"
        end
        hooks_arr = get_hooks(url)
        output = output_array(hooks_arr, opts)
        result.push({ file: filename, links: output.join(separator) }) if output
      end
      if result.length > 1 || opts[:format] == 'verbose'
        result.map! do |res|
          "#{res[:file]}\n\n#{res[:links]}\n"
        end
      else
        result.map! do |res|
          res[:links]
        end
      end
    end
    result.join(separator)
  end
def linked_bookmarks ( args , opts ) result = [ ] separator = args . length == 1 && opts [ :format ] == 'paths' && opts [ :null_separator ] ? "\0" : "\n" if args . nil? || args . empty? result = output_array ( all_bookmarks , opts ) else args . each do | url | source_mark = bookmark_for ( url ) filename = source_mark [ :name ] case opts [ :format ] when / ^m / filename = "[#{source_mark[:name]}](#{source_mark[:url]})" filename += " <file://#{CGI.escape(source_mark[:path])}>" if source_mark [ :path ] when / ^p / filename = "File: #{source_mark[:name]}" filename += " (#{source_mark[:path]})" if source_mark [ :path ] when / ^h / filename = "File: #{source_mark[:name]}" filename += " (#{source_mark[:url]})" if source_mark [ :url ] else filename = "Bookmarks attached to #{source_mark[:path] || source_mark[:url]}" end hooks_arr = get_hooks ( url ) output = output_array ( hooks_arr , opts ) result . push ( { file : filename , links : output . join ( separator ) } ) if output end if result . length > 1 || opts [ :format ] == 'verbose' result . map! do | res | "#{res[:file]}\n\n#{res[:links]}\n" end else result . map! do | res | res [ :links ] end end end result . join ( separator ) end
Get a list of all hooks on a file/url.
Get a list of all hooks on a file / url .
args
<not_specific>
opts
<not_specific>