internal static string FormatSingleLineDirect(PSObject obj,
                                                      ScriptBlock script,
                                                      PsContext ctx)
        {
            string val;

            using (FormatAltSingleLineCommand cmd = new FormatAltSingleLineCommand())
            {
                val = cmd.RenderScriptValue(obj, script, false, ctx);
            }
            // TODO: What to do if it spans more than a line? Just truncate? Issue a
            // warning? Add "..."? Also, consider that the view definition might have been
            // generated.
            if (null == val)
            {
                return(String.Empty);
            }
            else
            {
                int idx = CaStringUtil.ApparentIndexOf(val, '\n');
                if (idx < 0)
                {
                    return(val);
                }
                else
                {
                    return(CaStringUtil.Truncate(val, idx));
                }
            }
        } // end FormatSingleLineDirect
        } // end GenerateView()

        protected override void ApplyViewToInputObject()
        {
            string val = RenderScriptValue(InputObject, m_view.Script, false);

            // TODO: What to do if it spans more than a line? Just truncate? Issue a
            // warning? Add "..."? Also, consider that the view definition might have been
            // generated.
            if (null == val)
            {
                WriteObject(String.Empty);
            }
            else
            {
                //int idx = val.IndexOf( '\n' );
                // TODO: Now we pass 'false' for dontGroupMultipleResults, so I think this
                // won't ever get hit unless we are formatting a string that contains a
                // newline. Perhaps in that case we should escape it.
                int idx = CaStringUtil.ApparentIndexOf(val, '\n');
                if (idx < 0)
                {
                    WriteObject(val);
                }
                else
                {
                    WriteObject(CaStringUtil.Truncate(val, idx, false));
                }
            }
        } // end ApplyViewToInputObject()
        internal static string FormatSingleLineDirect(PSObject obj,
                                                      ScriptBlock script)
        {
#if DEBUG
            sm_renderScriptCallDepth++;
            if (sm_renderScriptCallDepth > 10)
            {
                // Helps to catch runaway rendering /before/ gobbling tons of memory
                System.Diagnostics.Debugger.Break();
                // Maybe I should just throw?
            }
#endif

            var ctxVars = new List <PSVariable> {
                new PSVariable("_", obj), new PSVariable("PSItem", obj)
            };
            var results = script.InvokeWithContext(null, ctxVars);

#if DEBUG
            sm_renderScriptCallDepth--;
#endif
            string val = null;
            if (results?.Count > 0)
            {
                val = ObjectsToMarkedUpString(results,
                                              "{0}", // <-- IMPORTANT: this prevents infinite recursion via Format-AltSingleLine
                                              null,
                                              false, 4).ToString();
            }

            // TODO: What to do if it spans more than a line? Just truncate? Issue a
            // warning? Add "..."? Also, consider that the view definition might have been
            // generated.
            if (null == val)
            {
                return(String.Empty);
            }
            else
            {
                int idx = CaStringUtil.ApparentIndexOf(val, '\n');
                if (idx < 0)
                {
                    return(val);
                }
                else
                {
                    return(CaStringUtil.Truncate(val, idx));
                }
            }
        } // end FormatSingleLineDirect
        internal static string FormatSingleLineDirect(PSObject obj,
                                                      ScriptBlock script,
                                                      bool allowMultipleLines)
        {
#if DEBUG
            sm_renderScriptCallDepth++;
            if (sm_renderScriptCallDepth > 10)
            {
                // Helps to catch runaway rendering /before/ gobbling tons of memory
                System.Diagnostics.Debugger.Break();
                // Maybe I should just throw?
            }
#endif

            var ctxVars = new List <PSVariable> {
                new PSVariable("_", obj), new PSVariable("PSItem", obj)
            };
            var results = script.InvokeWithContext(null, ctxVars);

#if DEBUG
            sm_renderScriptCallDepth--;
#endif
            string val = null;
            if (results?.Count > 0)
            {
                val = ObjectsToMarkedUpString(results,
                                              "{0}", // <-- IMPORTANT: this prevents infinite recursion via Format-AltSingleLine
                                              null,
                                              false, 4).ToString();
            }

            // TODO: What to do if it spans more than a line? Just truncate? Issue a
            // warning? Add "..."? Also, consider that the view definition might have been
            // generated.
            if (null == val)
            {
                return(String.Empty);
            }

            // Q. Why might an alleged single-line view generate multiple lines?
            //
            // A. Could be buggy. Could be a generated view, and somebody's ToString()
            //    generates multiple lines. In short: it's not necessarily "weird", or
            //    unusual.
            //
            // Q. Why would we want to allow multiple lines? Doesn't the name of this
            //    class / method say "format SINGLE LINE"?
            //
            // A. Sometimes multi-line views can not only be accommodated, they are
            //    desirable, such as for compatibility with the built-in Format-List
            //    command.

            if (allowMultipleLines)
            {
                return(val);
            }

            int idx = CaStringUtil.ApparentIndexOf(val, '\n');
            if (idx < 0)
            {
                return(val);
            }

            return(CaStringUtil.Truncate(val, idx));
        } // end FormatSingleLineDirect