leaves.rb 534 Bytes
Newer Older
Markus Reiter's avatar
Markus Reiter committed
1
# typed: true
2
3
# frozen_string_literal: true

BrewTestBot's avatar
BrewTestBot committed
4
require "formula"
5
require "cli/parser"
Jack Nagel's avatar
Jack Nagel committed
6

7
module Homebrew
Markus Reiter's avatar
Markus Reiter committed
8
9
  extend T::Sig

10
11
  module_function

Markus Reiter's avatar
Markus Reiter committed
12
  sig { returns(CLI::Parser) }
13
14
15
16
17
  def leaves_args
    Homebrew::CLI::Parser.new do
      usage_banner <<~EOS
        `leaves`

18
        List installed formulae that are not dependencies of another installed formula.
19
      EOS
Markus Reiter's avatar
Markus Reiter committed
20

21
      max_named 0
22
23
24
    end
  end

Jack Nagel's avatar
Jack Nagel committed
25
  def leaves
26
27
    leaves_args.parse

Tie's avatar
Tie committed
28
    Formula.installed_formulae_with_no_dependents.map(&:full_name).sort.each(&method(:puts))
Jack Nagel's avatar
Jack Nagel committed
29
30
  end
end