mirror of
				https://github.com/nsnail/spectre.console.git
				synced 2025-11-04 10:35:27 +08:00 
			
		
		
		
	Add interactive prompts for selecting values
* Adds SelectionPrompt * Adds MultiSelectionPrompt Closes #210
This commit is contained in:
		
				
					committed by
					
						
						Patrik Svensson
					
				
			
			
				
	
			
			
			
						parent
						
							3a593857c8
						
					
				
				
					commit
					0e0f4b4220
				
			
							
								
								
									
										20
									
								
								src/Spectre.Console/Extensions/Int32Extensions.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								src/Spectre.Console/Extensions/Int32Extensions.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,20 @@
 | 
			
		||||
namespace Spectre.Console
 | 
			
		||||
{
 | 
			
		||||
    internal static class Int32Extensions
 | 
			
		||||
    {
 | 
			
		||||
        public static int Clamp(this int value, int min, int max)
 | 
			
		||||
        {
 | 
			
		||||
            if (value <= min)
 | 
			
		||||
            {
 | 
			
		||||
                return min;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (value >= max)
 | 
			
		||||
            {
 | 
			
		||||
                return max;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return value;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user