<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SetIPLib;

namespace SetIPCLI {
    /// <summary>
    /// Returns a list of all profiles currently stored.
    /// Expected CLI syntax:
    ///   -l
    ///   -list
    /// </summary>
    class CLIListProfiles : ICLICommand {
        public ArgumentGroup Arguments { get; }

        public CLIListProfiles(ArgumentGroup args) {
            Arguments = args;

        }

        public void Execute(ref IProfileStore store) {
            IEnumerable<Profile> profiles;
            if (Arguments.Arguments.Count() > 0) {
                string filter = Arguments.Arguments.First();
                profiles = store.Retrieve().Where((p, b) => p.Name.ToUpper().Contains(filter.ToUpper()));
            }
            else {
                profiles = store.Retrieve();
            }

            foreach (var profile in profiles) {
                if (profile.UseDHCP) {
                    Console.WriteLine("{0,-35} DHCP", profile.Name);
                }
                else {<commit_msg>Updated List Profiles command to return a sorted list of profiles.<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SetIPLib;

namespace SetIPCLI {
    /// <summary>
    /// Returns a list of all profiles currently stored.
    /// Expected CLI syntax:
    ///   -l
    ///   -list
    /// </summary>
    class CLIListProfiles : ICLICommand {
        public ArgumentGroup Arguments { get; }

        public CLIListProfiles(ArgumentGroup args) {
            Arguments = args;

        }

        public void Execute(ref IProfileStore store) {
            IEnumerable<Profile> profiles;
            if (Arguments.Arguments.Count() > 0) {
                string filter = Arguments.Arguments.First();
                profiles = store.Retrieve().Where((p, b) => p.Name.ToUpper().Contains(filter.ToUpper()));
            }
            else {
                profiles = store.Retrieve();
            }

            foreach (var profile in profiles.OrderBy(p => p.Name)) {
                if (profile.UseDHCP) {
                    Console.WriteLine("{0,-35} DHCP", profile.Name);
                }
                else {
{'fraction_non_alphanumeric': 0.11230636833046471, 'fraction_numerical': 0.0034423407917383822, 'mean_word_length': 1.7744630071599046, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 14, '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': '1177709', 'n_tokens_mistral': 635, 'n_tokens_neox': 606, 'n_words': 155}