def run
      program :name, 'CredentialsManager'
      program :version, Fastlane::VERSION
      program :description, 'Manage credentials for fastlane tools.'

      # Command to add entry to Keychain
      command :add do |c|
        c.syntax = 'fastlane fastlane-credentials add'
        c.description = 'Adds a fastlane credential to the keychain.'

        c.option('--username username', String, 'Username to add.')
        c.option('--password password', String, 'Password to add.')

        c.action do |args, options|
          username = options.username || ask('Username: ')
          password = options.password || ask('Password: ') { |q| q.echo = '*' }

          add(username, password)

          puts("Credential #{username}:#{'*' * password.length} added to keychain.")
        end
      end

      # Command to remove credential from Keychain
      command :remove do |c|
        c.syntax = 'fastlane fastlane-credentials remove'
        c.description = 'Removes a fastlane credential from the keychain.'

        c.option('--username username', String, 'Username to remove.')

        c.action do |args, options|
          username = options.username || ask('Username: ')

          remove(username)
        end
      end

      run!
    end
def run
      program :name, 'CredentialsManager'
      program :version, Fastlane::VERSION
      program :description, 'Manage credentials for fastlane tools.'

      # Command to add entry to Keychain
      command :add do |c|
        c.syntax = 'fastlane fastlane-credentials add'
        c.description = 'Adds a fastlane credential to the keychain.'

        c.option('--username username', String, 'Username to add.')
        c.option('--password password', String, 'Password to add.')

        c.action do |args, options|
          username = options.username || ask('Username: ')
          password = options.password || ask('Password: ') { |q| q.echo = '*' }

          add(username, password)

          puts("Credential #{username}:#{'*' * password.length} added to keychain.")
        end
      end

      # Command to remove credential from Keychain
      command :remove do |c|
        c.syntax = 'fastlane fastlane-credentials remove'
        c.description = 'Removes a fastlane credential from the keychain.'

        c.option('--username username', String, 'Username to remove.')

        c.action do |args, options|
          username = options.username || ask('Username: ')

          remove(username)
        end
      end

      run!
    end
Parses command options and executes actions