<commit_before>require 'duse/cli'
require 'openssl'

module Duse
  module CLI
    class SaveSecret < ApiCommand
      description 'Save a new secret'

      def run(*arguments)
        title       = terminal.ask 'What do you want to call this secret? '
        secret_text = terminal.ask 'Secret to save: '
        users       = who_to_share_with

        users << Duse::User.find('me')
        users << Duse::User.find('server')
        private_key = OpenSSL::PKey::RSA.new File.read File.expand_path '~/.ssh/id_rsa'
        secret      = Duse::Client::Secret.new title: title, secret_text: secret_text, users: users
        secret_hash = Duse::Client::SecretMarshaller.new(secret, private_key).to_h
<commit_msg>add title and secret flags for secret<commit_after>require 'duse/cli'
require 'openssl'

module Duse
  module CLI
    class SaveSecret < ApiCommand
      description 'Save a new secret'

      on('-t', '--title [TITLE]',   'The title for the secret to save')
      on('-s', '--secret [SECRET]', 'The secret to save')

      def run(*arguments)
        self.title  ||= terminal.ask 'What do you want to call this secret? '
        self.secret ||= terminal.ask 'Secret to save: '
        users       = who_to_share_with

        users << Duse::User.find('me')
        users << Duse::User.find('server')
        private_key = OpenSSL::PKey::RSA.new File.read File.expand_path '~/.ssh/id_rsa'
        secret      = Duse::Client::Secret.new title: self.title, secret_text: self.secret, users: users
        secret_hash = Duse::Client::SecretMarshaller.new(secret, private_key).to_h

{'fraction_non_alphanumeric': 0.1220125786163522, 'fraction_numerical': 0.0, 'mean_word_length': 2.8995098039215685, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5080259', 'n_tokens_mistral': 500, 'n_tokens_neox': 489, 'n_words': 133}